Skip to main content

toggle_button

Function toggle_button 

Source
pub fn toggle_button(state: impl Fn() -> bool + 'static) -> ToggleButton
👎Deprecated
Expand description

A reactive toggle button.

When the button is toggled by clicking or dragging the widget, an update will be sent to the ToggleButton::on_toggle handler.

By default this toggle button has a style class of ToggleButtonClass applied with a default style provided.

§Examples

// An example using read-write signal
let state = RwSignal::new(true);
let toggle = toggle_button(move || state.get())
    .on_toggle(move |new_state| state.set(new_state));

§Reactivity

This function is reactive and will reactively respond to changes.