Expand description
SplitButton — a button split into two regions sharing a single frame.
The left region is the default action: it shows the label of the
currently-selected item and, on click, fires that item’s command
(behaving like a regular Button). The right
region is a narrow chevron zone that, on click, opens a
MenuList of related actions. Picking an
action from the dropdown fires it and promotes its index to become the
new default for the session (IntelliJ’s “remember last used”
convention).
SplitButton reuses MenuItem verbatim
for the dropdown rows — the caller passes real MenuItem values via
.item(...), so icons, shortcut labels, enabled flags, and separators
all come for free.
let _w = SplitButton::new()
.item(MenuItem::new(lit!("Run")).on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.run"))))
.item(MenuItem::new(lit!("Run Tests")).on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.run-tests"))))
.separator()
.item(MenuItem::new(lit!("Debug")).on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.debug"))))
.variant(ButtonVariant::Plain);Structs§
- Split
Button - A button split into a default-action region and a chevron dropdown region.
Constants§
- SPLIT_
BUTTON_ BORDER_ WIDTH - SPLIT_
BUTTON_ CHEVRON_ ICON_ SIZE - SPLIT_
BUTTON_ CHEVRON_ WIDTH - SPLIT_
BUTTON_ CORNER_ RADIUS - SPLIT_
BUTTON_ DIVIDER_ WIDTH - SPLIT_
BUTTON_ HEIGHT - SplitButton design tokens.
- SPLIT_
BUTTON_ ICON_ LABEL_ GAP - Gap between an optional main-region leading icon and the label.
- SPLIT_
BUTTON_ MIN_ WIDTH - SPLIT_
BUTTON_ PADDING_ HORIZONTAL - SPLIT_
BUTTON_ PADDING_ VERTICAL