iced::widget

Module checkbox

Source
Expand description

Checkboxes can be used to let users make binary choices.

§Example

use iced::widget::checkbox;

struct State {
   is_checked: bool,
}

enum Message {
    CheckboxToggled(bool),
}

fn view(state: &State) -> Element<'_, Message> {
    checkbox("Toggle me!", state.is_checked)
        .on_toggle(Message::CheckboxToggled)
        .into()
}

fn update(state: &mut State, message: Message) {
    match message {
        Message::CheckboxToggled(is_checked) => {
            state.is_checked = is_checked;
        }
    }
}

Checkbox drawn by iced_wgpu

Structs§

Checkbox
A box that can be checked.
Icon
The icon in a Checkbox.
Style
The style of a checkbox.

Enums§

Status
The possible status of a Checkbox.

Traits§

Catalog
The theme catalog of a Checkbox.

Functions§

danger
A danger checkbox; denoting a negative toggle.
primary
A primary checkbox; denoting a main toggle.
secondary
A secondary checkbox; denoting a complementary toggle.
success
A success checkbox; denoting a positive toggle.

Type Aliases§

StyleFn
A styling function for a Checkbox.