Expand description
Checkbox — a two-state or tristate checkbox with an optional label.
Checkbox renders a square (or rounded-square / circle) toggle box
alongside an optional label and caption. Two modes are supported:
- Two-state (
Checkbox::new): toggles aSignal<bool>betweentrue(checked) andfalse(unchecked) on click or Space. - Tristate (
Checkbox::tristate): cycles aSignal<CheckState>betweenCheckedandUncheckedon user interaction; theIndeterminatestate is set only by external sources such asTreeCheckedModelaggregation — clicking fromIndeterminategoes toChecked, not a further third state.
Chrome (box shape, fill, focus ring) is driven by the active
CheckboxStyle; three visual variants are available via
[CheckboxVariant].
§Accessibility
Announces as Role::CheckBox. A label is required in debug builds
unless .labels_hidden(true) is set (for embedding inside a composite
row that owns the AT name). Keyboard: Space toggles; lone-KeyUp guard
prevents spurious toggle when focus is restored after a shortcut.
let checked = Signal::new(false);
let _cb = Checkbox::new(checked)
.label(lit!("Accept terms and conditions"));Structs§
- Checkbox
- A checkbox that toggles a
Signal<bool>or cycles aSignal<CheckState>.