Layout
PreviewSplit panes, disclosures, cards, dividers, breadcrumbs, toolbars, popovers and confirm sheets: the structure Pitwall's own screens are built from, for tiles. The examples come from the Layout page of the gallery tile (crates/pitwall-tile-host/tests/fixtures/hello-tile/src/widgets.rs), the screenshots from that tile drawn headless. See also Form controls, Feedback, Data display and Charts; for rows and columns of boxes, Elements and Styles.
Split pane

Two panes with a bar between them the user drags: a list beside its detail, an editor over its output. h_split() puts them side by side, v_split() one above the other.
let panes = h_split()
.id("panes")
.initial(0.4)
.min_sizes(120., 160.)
.first(v_flex().p(px(12.)).gap_1().child(text("Runs").font_semibold()).child(text("#412 main").text_sm()).child(text("#411 fix/login").text_sm()))
.second(v_flex().p(px(12.)).gap_1().child(text("Run #412").font_semibold()).child(text("Passed in 3 min").text_color(Token::Text3)))
.on_resize(cx.listener(|t: &mut Hello, share: &f64, cx| {
t.widgets.split_share = Some(*share);
cx.notify();
}));
| Option | What it does |
|---|---|
h_split(), v_split() | A split, side by side or stacked |
.first(element), .second(element) | The two panes (both are needed) |
.initial(share) | The first pane's share at first, 0.05–0.95 (default 0.5) |
.min_sizes(first, second) | The panes' smallest sizes in logical pixels (default 80 each) |
.on_resize(listener) | Hears the first pane's share (&f64) when a drag ends |
- The user's size. Pitwall keeps the size the user dragged to for the view, by the split's key path, across restarts; the tile doesn't need to store it.
on_resizeis for a tile that wants to know. - Events.
value-changedwithnumber(share), once at the end of a drag. - Size. Give it a size, or let it grow (
.flex_1()). - Limits. Exactly two children.
- Test.
t.resize_split("key", 0.7)(kept within the minimum sizes, as Pitwall does).
Disclosure

A section the user opens and closes, for detail most people don't need every time: an environment, advanced options.
let env = disclosure("Environment", self.env_open)
.id("env")
.detail("3 variables")
.on_toggle(cx.listener(|t: &mut Hello, open: &bool, cx| {
t.widgets.env_open = *open;
cx.notify();
}))
.child(key_values().entry("CI", "true").mono().entry("NODE_ENV", "test").mono().entry("RUST_LOG", "info").mono());
| Option | What it does |
|---|---|
disclosure(title, open) | A section; its children are drawn under the header while open |
.detail(text) | Muted text at the header's right (a count, a summary) |
.on_toggle(listener) | Hears the new state (&bool: open) |
- Events.
value-changedwithon(open). - Keyboard. The header is a Tab stop; Enter or Space opens and closes it.
- Accessibility. The title is its name; open or closed is read with it.
- Test.
t.toggle("key");t.key_on("key", "enter").
Card

A bordered box on the raised surface, for one item among others: a run, a deploy, a service. With on_click the whole card is clickable.
let run = card()
.id("run")
.title("Last run")
.detail("main")
.on_click(cx.listener(|t: &mut Hello, _: &Click, cx| said(t, "Opened run #412", cx)))
.child(h_flex().gap_2().items_center().child(badge("passed").tone(Tone::Good)).child(text("#412 · 3 min").text_color(Token::Text2)));
| Option | What it does |
|---|---|
card() | A card; its children are its body |
.title(text) | A title at its top |
.detail(text) | Muted text at the title's right |
.on_click(listener) | The card is clickable: hears Click |
- Keyboard. A clickable card is a Tab stop; Enter or Space clicks it.
- Accessibility. The title is its name.
- Test.
t.click_key("key");t.key_on("key", "enter").
Divider

A hairline in the theme's line colour: divider() across stacked things, vertical_divider() between things in a row (give the row a height).
let lines = v_flex()
.gap_2()
.w(px(280.))
.child(text("Today"))
.child(divider())
.child(h_flex().gap_2().items_center().h(px(20.)).child(text("12 runs")).child(vertical_divider()).child(text("2 failed")));
Breadcrumbs

Where the user is in something nested (an org, a repository, a run), each level but the last clickable to go back up.
let crumbs = self
.path
.iter()
.fold(breadcrumbs().id("crumbs"), |b, level| b.crumb(*level, *level))
.on_pick(cx.listener(|t: &mut Hello, key: &str, cx| {
// Back up to the level clicked.
if let Some(at) = t.widgets.path.iter().position(|p| *p == key) {
t.widgets.path.truncate(at + 1);
}
cx.notify();
}));
| Option | What it does |
|---|---|
breadcrumbs() | An empty trail |
.crumb(key, label) | A level; the last is where the user is |
.on_pick(listener) | Hears the key (&str) of the level clicked |
- Events.
value-changedwithchoice(key). - Keyboard. With
on_pick, a Tab stop; the levels are buttons. - Limits. 32 levels; keys unique.
- Test.
t.choose("key", "level")(the last level can't be picked).
Toolbar row

A row of buttons and fields at the top of a tile, with Pitwall's bar look: its height, spacing and the hairline under it. Put a div().flex_1() in it to push what follows to the right.
let bar = toolbar()
.id("bar")
.child(search_field("filter").placeholder("Filter").w(px(180.)))
.child(segmented().id("which").option("all", "All").option("failed", "Failed").selected("all"))
.child(div().flex_1())
.child(icon_button(Icon::Refresh, "Refresh").id("refresh"))
.child(button("New run").id("new").small().primary());
| Option | What it does |
|---|---|
toolbar() | A toolbar; its children are laid out in a row |
Popover

A floating panel anchored to an element: filters, a small form, details on demand. Pitwall draws it inside the tile, above everything else, and keeps it in sight.
let mut filters = div().id("filters").child(button("Filters").id("open").icon(Icon::ChevronDown).on_click(cx.listener(|t: &mut Hello, _: &Click, cx| {
t.widgets.popover_open = !t.widgets.popover_open;
cx.notify();
})));
if self.popover_open {
filters = filters.child(
popover()
.id("pop")
.width(240.)
.on_dismiss(cx.listener(|t: &mut Hello, _: &Dismissed, cx| {
t.widgets.popover_open = false;
cx.notify();
}))
.child(v_flex().gap_2().p(px(12.)).child(text("Show").font_semibold()).child(checkbox("Failed runs").id("failed").checked(true)).child(checkbox("Cancelled runs").id("cancelled"))),
);
}
| Option | What it does |
|---|---|
popover() | A popover; its children are its content |
.placement(Placement) | Below (default), Above, Start or End of its anchor |
.width(px) | Its width (default: its content's, 160–480) |
.at(x, y) | Anchor it to that point of its parent (pixels from the parent's top-left corner, as a click's at) instead of the parent's edge |
.on_dismiss(listener) | Hears Dismissed: Esc, or a click outside it. Leave it out of the next render |
- Anchor. It is open while it is in the frame, anchored to its parent: put it in a box with the button that opens it, as the example does. With
.at(x, y)it hangs from a point of the parent instead, on the side.placementsays; on a canvas (canvas.popover(…)), under the box that was clicked (Canvas). - Events.
dismissedon Esc or a click outside. - Keyboard. Esc closes it; Tab moves among its controls.
- Limits. One popover a frame; it can't be the root.
- Test.
t.key_on("key", "escape");t.dismiss("key"). The snapshot sayspopover at (x, y)for one anchored to a point.
Confirm sheet

Asking the user to confirm before something that can't be undone. Tiles can't open the system's dialogs, so this is how a tile asks: a sheet over the tile, the rest of it dimmed and taking no input, in Pitwall's dialog look.
let mut notes = v_flex().id("notes").size_full().gap_2().p(px(12.)).child(button("Delete 3 notes…").id("delete").danger().on_click(cx.listener(|t: &mut Hello, _: &Click, cx| {
t.widgets.asking = true;
cx.notify();
})));
if self.asking {
notes = notes.child(
confirm_sheet("Delete 3 notes?", "Delete")
.id("ask")
.text("They can't be brought back.")
.danger()
.on_confirm(cx.listener(|t: &mut Hello, _: &Click, cx| {
t.widgets.deleted += 3;
t.widgets.asking = false;
cx.notify();
}))
.on_cancel(cx.listener(|t: &mut Hello, _: &Dismissed, cx| {
t.widgets.asking = false;
cx.notify();
})),
);
}
| Option | What it does |
|---|---|
confirm_sheet(title, confirm) | A sheet asking title, with a button labelled confirm |
.text(text) | More about it |
.cancel_label(text) | The cancel button's label (default "Cancel") |
.danger() | The confirm button is red |
.on_confirm(listener) | Hears Click when the user confirms |
.on_cancel(listener) | Hears Dismissed on Cancel, Esc or a click on the dimmed tile |
- Placement. Shown while it is in the frame, wherever it is in the tree.
- Events.
clickto confirm;dismissedto cancel. Leave it out of the next render either way. - Keyboard. While it is open, Enter confirms and Esc cancels wherever focus is in the tile.
- Wording. Say the action in the title and on the button ("Delete 3 notes?", "Delete"), not "Are you sure?" and "OK".
- Limits. One confirm sheet a frame.
- Test.
t.key_on("key", "enter");t.key_on("key", "escape");t.dismiss("key").