Skip to main content

toggle_button

Function toggle_button 

Source
pub fn toggle_button<State: 'static, F: Fn(&mut State, bool) + 'static>(
    checked: bool,
    on_checked_change: F,
) -> ToggleButtonView<State>
Expand description

Create a filled (highest-emphasis) toggle button reporting the requested checked value through on_checked_change on release inside its bounds — the reference’s default M3EToggleButton/M3EToggleButton.filled.

A controlled component (see the module docs): checked never self-mutates. Chain ToggleButtonView::icon/ToggleButtonView::label (and their checked_* siblings) to add content, and ToggleButtonView::size/ToggleButtonView::variant for the other tiers.