Expand description
Togglers let users make binary choices by toggling a switch.
§Example
use iced::widget::toggler;
struct State {
is_checked: bool,
}
enum Message {
TogglerToggled(bool),
}
fn view(state: &State) -> Element<'_, Message> {
toggler(state.is_checked)
.label("Toggle me!")
.on_toggle(Message::TogglerToggled)
.into()
}
fn update(state: &mut State, message: Message) {
match message {
Message::TogglerToggled(is_checked) => {
state.is_checked = is_checked;
}
}
}
Show toggle controls using togglers.
Structs§
- The appearance of a toggler.
- A toggler widget.
Enums§
- The possible status of a
Toggler
.
Traits§
- The theme catalog of a
Toggler
.
Functions§
- The default style of a
Toggler
.
Type Aliases§
- A styling function for a
Toggler
.