Module cosmic::iced_widget::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;
}
}
}
Show toggle controls using checkboxes.
Structs§
- A box that can be checked.
- The icon in a
Checkbox
. - The style of a checkbox.
Enums§
- The possible status of a
Checkbox
.
Traits§
- The theme catalog of a
Checkbox
.
Functions§
- A danger checkbox; denoting a negative toggle.
- A primary checkbox; denoting a main toggle.
- A secondary checkbox; denoting a complementary toggle.
- A success checkbox; denoting a positive toggle.
Type Aliases§
- A styling function for a
Checkbox
.