PITWALL

Feedback

Preview

Progress bars, spinners, skeletons, empty states, banners, badges, chips, key hints and tooltips: how a tile says what is going on, drawn as Pitwall's own screens say it. The examples come from the Feedback 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, Layout, Data display and Charts.

Colours by meaning come from Tone: Info, Good, Warn, Bad, drawn with the theme's own colours for them, in dark and light.

Progress bar

Progress bars, dark Progress bars, light

Work with a known end (indexing, an upload), or still going with none known. For a short wait in place, use a spinner.

let bars = v_flex()
    .gap_3()
    .w(px(280.))
    .child(progress(Some(0.62)).id("indexing").label("Indexing files"))
    .child(progress(Some(1.)).id("uploaded").tone(Tone::Good).label("Uploaded"))
    // Still going, with no share known.
    .child(progress(None).id("waiting").label("Waiting for the runner"));
OptionWhat it does
progress(Some(share))A bar share done, 0.0–1.0 (kept in it)
progress(None)Indeterminate: a moving band (still with Reduce motion on)
.tone(Tone)Its colour by meaning (default: the text colour)
.label(text)What it measures; drawn by screen readers, not on screen
  • Events. None.
  • Accessibility. Name it with .label("…"); its value is read as a percentage.
  • Test. The snapshot shows progress 62% or progress indeterminate.

Spinner

Spinner, dark Spinner, light

Something is loading and will be here soon: Pitwall's own spinning ring. Pair it with a line saying what.

let loading = h_flex().gap_2().items_center().child(spinner().id("spin").label("Loading")).child(text("Loading runs…").text_color(Token::Text3));
OptionWhat it does
spinner()The ring, as tall as the text
.label(text)Its accessible name ("Loading")
  • Motion. It turns without the tile doing anything; with Reduce motion it is still.

Skeleton

Skeleton, dark Skeleton, light

A grey placeholder in the shape of content that is loading, so the layout doesn't jump when it comes.

let placeholder = h_flex().gap_3().items_start().w(px(300.)).child(skeleton(SkeletonShape::Circle).size(px(28.))).child(v_flex().flex_1().child(skeleton(SkeletonShape::Lines(3))));
OptionWhat it does
skeleton(SkeletonShape::Lines(n))n lines of text (1–20), the last shorter
skeleton(SkeletonShape::Block)A box; give it a size
skeleton(SkeletonShape::Circle)A circle as tall as its width (an avatar's place)
  • Motion. It shimmers, unless Reduce motion is on.
  • Limits. 20 lines.

Empty state

Empty state, dark Empty state, light

Nothing to show yet, and what to do about it: as Pitwall's own lists say they are empty. Centred in its box.

let empty = empty_state("No runs yet")
    .id("empty")
    .icon(Icon::Folder)
    .text("Runs show here when CI starts one.")
    .action("Refresh", cx.listener(|t: &mut Hello, _: &Click, cx| said(t, "Refreshed", cx)));
OptionWhat it does
empty_state(title)The title
.icon(Icon)An icon over it
.text(text)A line under it: why, or what to do
.action(label, listener)A button; its listener hears Click
  • Events. click from the action.
  • Keyboard. The action is a Tab stop.

Banners, dark Banners, light

A message in the tile's flow: information, success, a warning or an error, with an action and a close button. Use it for something that stays true until fixed (a refused token); for "Saved", a toast (ui::toast) is enough.

if self.banner_shown {
    col = col.child(
        banner(Tone::Bad, "The CI token was refused. Sign in again to load runs.")
            .id("token")
            .title("Can't load runs")
            .action("Sign in", cx.listener(|t: &mut Hello, _: &Click, cx| said(t, "Signing in", cx)))
            .on_dismiss(cx.listener(|t: &mut Hello, _: &Dismissed, cx| {
                t.widgets.banner_shown = false;
                cx.notify();
            })),
    );
}
col = col
    .child(banner(Tone::Info, "Runs older than 90 days are archived.").id("info"))
    .child(banner(Tone::Good, "Deployed to staging.").id("good"))
    .child(banner(Tone::Warn, "Two runners are offline.").id("warn"));
OptionWhat it does
banner(Tone, text)A banner of that tone
.title(text)A bold first line
.action(label, listener)A button; its listener hears Click
.on_dismiss(listener)A close button; its listener hears Dismissed. Leave the banner out of the next render
  • Events. click from the action; dismissed from the close button.
  • Keyboard. The action and the close button are Tab stops.
  • Accessibility. Don't rely on the colour alone: say what happened in the text or the title.
  • Test. t.dismiss("key"); the snapshot shows banner bad "…" title=… action=… dismissible.

Badge

Badges, dark Badges, light

A small count or status beside something: "3 failing", "beta". Not clickable; for a tag the user picks or removes, use a chip.

let badges = h_flex()
    .gap_2()
    .child(badge("12"))
    .child(badge("3 failing").tone(Tone::Bad))
    .child(badge("passing").tone(Tone::Good))
    .child(badge("flaky").tone(Tone::Warn))
    .child(badge("beta").tone(Tone::Info));
OptionWhat it does
badge(text)A badge
.tone(Tone)Its colour by meaning (default: neutral)
  • Limits. 32 bytes of text.

Chip

Chips, dark Chips, light

A tag or a filter: picked on and off with a click, or removed with its ×.

let mut chips = h_flex().gap_2().flex_wrap().w(px(360.)).child(chip("Flaky only").id("flaky").icon(Icon::Restart).selected(self.flaky_only).on_click(cx.listener(|t: &mut Hello, _: &Click, cx| {
    t.widgets.flaky_only = !t.widgets.flaky_only;
    cx.notify();
})));
for tag in self.tags.iter().copied() {
    chips = chips.child(chip(tag).id(tag).on_remove(cx.listener(move |t: &mut Hello, _: &Dismissed, cx| {
        t.widgets.tags.retain(|have| *have != tag);
        cx.notify();
    })));
}
let chips = chips.child(chip("main").id("main").tone(Tone::Good));
OptionWhat it does
chip(label)A chip
.icon(Icon)An icon before the label
.tone(Tone)Its colour by meaning
.selected(bool)Drawn picked (a filter that is on)
.disabled(bool)Dimmed; no clicks
.on_click(listener)Clickable: hears Click
.on_remove(listener)A × that sends Dismissed
  • Events. click; dismissed from the × (or the keys below).
  • Keyboard. A chip that can be clicked or removed is a Tab stop. Enter or Space clicks it; Backspace or Delete removes it.
  • Test. t.click_key("key"); t.dismiss("key"); t.key_on("key", "backspace").

Key hint

Key hints, dark Key hints, light

A key or shortcut, drawn as Pitwall draws its own: "cmd-k" is ⌘K on macOS and Ctrl+K elsewhere. Use the names the keymap uses (Keys).

let hint = h_flex().gap_2().items_center().child(text("Search").text_color(Token::Text3)).child(kbd("cmd-k")).child(text("or").text_color(Token::Text3)).child(kbd("/"));
OptionWhat it does
kbd(keys)The key, as bind_key names it ("cmd-k", "shift-enter", "/")

Tooltip

Tooltips, dark Tooltips, light

.tooltip("…") works on any element, components included: Pitwall's own tooltip after the usual hover delay. An icon button gets its label as its tooltip (icon_button(icon, label)). Keep it to a few words that add something; don't hide what the user needs to act on.

let tips = h_flex()
    .gap_2()
    .items_center()
    .child(button("Deploy").id("deploy").tooltip("Deploys main to staging"))
    .child(icon_button(Icon::Refresh, "Refresh runs").id("refresh"))
    .child(badge("3").id("failed").tone(Tone::Bad).tooltip("3 runs failed today"));
  • Accessibility. An element with no text needs .label("…") as well; a tooltip isn't its name.
  • Test. The node's tooltip field holds it (t.find_key("key").unwrap().node.tooltip).