Components / Layout & organisation

Collapsible

Markdown crates/ui/src/widgets/layout.rs docs.rs

Collapsible

Ask your agent

Install the bezel skill once

npx skills add crabtalk/bezel --skill bezel

Then ask

Add a collapsible "Details" section to the run view that opens itself while the run is going, until I click it.
use ui::widgets::{Layout, Takeover};

let open = self.details.get(self.running);   // self.details: Takeover
div()
    .child(div().id("details")
        .on_click(cx.listener(|view, _, _, cx| {
            view.details.toggle(view.running);
            cx.notify();
        }))
        .child(theme.collapsible_header("Details", open)))
    .when(open, |el| el.child(body))
  • The header is a row, not a container: render the body yourself. A plain bool works where nothing drives it.
  • Takeover follows its auto value until the first toggle, then holds the user's choice. Pass the same auto to get and toggle.
  • Hover is the caller's; Theme::element_hover is the wash.