Skip to main content

split_button

Function split_button 

Source
pub fn split_button<State, P, O>(
    label: impl Into<String>,
    open: bool,
    on_press: P,
    on_open: O,
) -> SplitButtonView<State>
where State: 'static, P: Fn(&mut State) + 'static, O: Fn(&mut State) + 'static,
Expand description

Create a split button labelled label, with a leading on_press action and a trailing on_open menu callback.

open reflects whether the menu the app presents is currently showing: it drives the chevron’s rotation and the trailing half’s open shape, and — as a controlled component — it moves only when the app feeds a new value back (typically toggled inside on_open), never by itself. Pass false for a plain action+menu split button that never rotates.

Chain SplitButtonView::size/SplitButtonView::variant/ SplitButtonView::shape for the reference’s other tiers, SplitButtonView::items plus SplitButtonView::on_select to describe the menu, and SplitButtonView::menu_route to get the presentation the chosen SplitButtonView::menu_style calls for.