Expand description
ToolBox — a vertical stack of collapsible sections, exactly one expanded at a time.
Semantic cousin of Qt’s QToolBox and the collapsible groups in
IntelliJ’s Settings dialog. Differs from Accordion
(single-item independent disclosure) and TabWidget
(horizontal tab bar with dormant panes) by combining vertical layout,
always-visible headers, and exclusive expansion in one widget.
Int UI visual language:
- flat, borderless headers (no corner radius)
- 1 dp accent indicator bar on the leading edge of the active header
- color-only emphasis (selected / hover / pressed surface roles)
- border IS the focus ring: an accent border at the theme’s
focus_ring_width(2 dp under Int UI) appears on the focused header, no separate ring primitive - content swaps are instant — Int UI’s house rule is to avoid
decorative animation for inline transitions; see
MotionTokens. Matches the existingTabWidgetprecedent where pane swaps have no transition.
ⓘ
let selected = ctx.signal(0_usize);
ToolBox::new(selected.clone())
.item(lit!("Outline"), outline_widget)
.item(lit!("Properties"), properties_widget)
.add(ToolBoxItem::new(lit!("Build"), build_widget).enabled(false))§Touch and pen
A section header activates from its tap, so it already actuates on the release. Two things did change:
- its pressed appearance is the framework’s press now, not the keyboard path’s — before, the recipe painted a state no pointer of either kind ever wrote;
- a tap by a contact rests the header idle rather than hovered. A finger
sends no hover-leave to correct a resting
Hoveredwith, so a tapped header stayed lit with nothing on it — visible once the selection moved elsewhere, because a selected header’s own chrome hides the tint until then.
The optional header drag (on_header_drag, the dock panel’s handle) needs no
declaration for a contact: DragActivation::Auto resolves to Immediate
where nothing competes for the axis, and to the hold where a scroller does.
Structs§
- ToolBox
- A vertical container of collapsible sections with exactly one expanded
at a time — the Int UI /
QToolBoxpattern. - Tool
BoxItem - One section of a
ToolBox. Construct withToolBoxItem::newand pass toToolBox::add, or use the convenienceToolBox::itembuilder directly (it takes a widget or aWidgetId) when leading / trailing slots and tooltip are not needed.
Enums§
- Tool
BoxOrientation - Orientation of a
ToolBox: how its collapsible sections are arranged.
Constants§
- TOOL_
BOX_ CHEVRON_ SIZE - TOOL_
BOX_ HEADER_ MIN_ HEIGHT - ToolBox design tokens.
- TOOL_
BOX_ HEADER_ PADDING_ HORIZONTAL - TOOL_
BOX_ ICON_ TEXT_ SPACING - TOOL_
BOX_ INDICATOR_ THICKNESS
Functions§
- tool_
box_ header_ min_ height TOOL_BOX_HEADER_MIN_HEIGHTraised to the density’starget_size(24 / 32 / 44 dp). The identity at Compact.- tool_
box_ header_ padding_ horizontal TOOL_BOX_HEADER_PADDING_HORIZONTALscaled by the density’sspacing_factor(1.00 / 1.15 / 1.30).- tool_
box_ icon_ text_ spacing TOOL_BOX_ICON_TEXT_SPACINGscaled by the density’sspacing_factor(1.00 / 1.15 / 1.30).