Expand description
Accordion — a collapsible section with a clickable header that shows or hides its content when activated.
In the default vertical mode a horizontally-spanning header row sits above the
content; clicking or pressing Space/Enter toggles visibility with an animated
height disclosure (via Collapse).
A horizontal mode flips the header into a narrow vertical strip with a rotated
label — used by top/bottom sides of a DockingLayout. Fill mode (.fill(true))
is designed for fixed-size slots such as Splitter panes: the content fills all
available space and collapse animation is driven externally by the enclosing
pane rather than by an internal height tween.
§Accessibility
The header is announced as Role::Button with aria-expanded reflecting the
current state, and aria-controls pointing at the content region
(Role::Region). Space/Enter toggle the disclosure; AT “click” actions are
also handled. The focus ring appears only on keyboard focus (not on pointer
clicks), matching the IntUI convention.
let expanded = Signal::new(false);
let _accordion = Accordion::new(lit!("Advanced settings"), expanded);§Touch and pen
The header is one target on the density ladder and toggles from its tap, so on
the release. Where a dock panel installs on_header_drag, the same header is
also a drag source: DragActivation::Auto resolves that to Immediate when
nothing competes for the axis and to the hold when a scroller does, so a contact
needs no declaration to move a panel — and a press that lifts without
travelling still toggles.
The trailing slot is wrapped in a DeadZone, so
its action buttons and ⋮ menu take a press — jitter and all — without arming
the panel drag behind them.
Structs§
- Accordion
- A collapsible section widget whose header button shows or hides attached content.
Enums§
- Accordion
Orientation - Orientation of an
Accordion: how its header sits relative to its content.Vertical(the default) is a horizontal header row above the content;Horizontalis a narrow vertical header strip (rotated-90° label, left/right chevron) beside the content — used by top/bottom dock sides.
Constants§
- ACCORDION_
CORNER_ RADIUS - Corner radius of the keyboard-focus ring painted on the accordion header.
- ACCORDION_
HEADER_ HEIGHT - Height of the accordion header row in pixels (vertical mode).
- ACCORDION_
HEADER_ PADDING_ HORIZONTAL - Horizontal padding inside the accordion header on the leading and trailing edges.
- ACCORDION_
INDICATOR_ GAP - Gap between the disclosure indicator and the title label.
- ACCORDION_
INDICATOR_ SIZE - Size of the chevron disclosure indicator icon in pixels.
Functions§
- accordion_
header_ height ACCORDION_HEADER_HEIGHTraised to the density’starget_size(24 / 32 / 44 dp). The identity at Compact.- accordion_
header_ padding_ horizontal ACCORDION_HEADER_PADDING_HORIZONTALscaled by the density’sspacing_factor(1.00 / 1.15 / 1.30).- accordion_
indicator_ gap ACCORDION_INDICATOR_GAPscaled by the density’sspacing_factor(1.00 / 1.15 / 1.30).