Expand description
<checkbox> behavior: box + label control on top of the shared
Toggleable machinery, with a tri-state indeterminate mode.
The markup parser desugars <checkbox label="..."> into a row (tag
checkbox, carrying Toggleable + CheckboxStyle) with two
real child elements - a .checkbox-box tile (carrying
CheckboxBox) and a .checkbox-label label - so every visual is
CSS-reachable through the skins:
.checkbox-box { width: 18; height: 18; bg: ...; border: ...; }
checkbox:checked { bg: var(--lumen-accent); } /* box fill when on */
checkbox:focus { outline: 2 var(--lumen-accent); }Behavior reuse:
- Click anywhere on the row (box, label, gap) toggles -
crate::controls::flip_toggle_on_clickresolves child hits to the ancestorToggleable, exactly like<toggle>. - Space on the focused checkbox toggles -
lumen_input::activate_focused_on_enter’s press-and-release FSM emits the sameClickEvent. bind-checked/on_toggle(id, checked)come withToggleable.
Tri-state: indeterminate="true" inserts the Indeterminate
marker. The box renders a dash while it’s present; the first user
toggle (click / Space - anything that fires
crate::controls::ToggleChanged) clears it, mirroring the web’s
indeterminate IDL attribute and Qt’s PartiallyChecked. Script
bind-checked writes do not clear it.
Structs§
- Checkbox
Box - Marker on the
.checkbox-boxchild tile. Its checked fill is held inStyleOverridesover the box’s own. - Checkbox
Plugin - Plugin: registers the visual sync + indeterminate-clear systems.
The toggle behavior itself ships with
crate::ControlsPlugin. - Checkbox
Style - Per-checkbox fill for the checked / indeterminate box state,
resolved at spawn from
checkbox:checked { bg: ... }(routed throughAttributes::checked_bg) with the accent fallback. - Indeterminate
- Tri-state marker on the checkbox ROOT: renders a dash regardless of
checkeduntil the first user toggle removes it.
Functions§
- clear_
indeterminate_ on_ user_ toggle - First user toggle clears
Indeterminate(web/Qt tri-state contract). Listens toToggleChanged- fired only by the user input path, not bybind-checkedsignal pulls. - sync_
checkbox_ visuals - Keep every
.checkbox-boxchild in step with its parent state: