pub struct Checkbox {
pub checked: bool,
pub indeterminate: bool,
/* private fields */
}Expand description
A checkbox with optional label — brought to the Quality Bar (see
.steering/WIDGET_QUALITY_BAR.md; matches the Switch exemplar).
- States — unchecked/checked/indeterminate · hover · pressed (box dips) · focus-visible (ring) · disabled (dimmed, inert).
- Motion — box fill + border ease on toggle; the checkmark pops in (scales 0.5→1 while it fades); the hover/press/focus state-layer halo fades smoothly. Three independent animation channels, all idle when settled.
- Theming — fill from
primary, border fromoutline, ink is a bright high-contrast tick; light+dark adaptive; overridable. - A11y —
Role::Checkboxwith checked/unchecked value + optional label. - Interactive-by-identity — always owns its hit region.
Fields§
§checked: bool§indeterminate: boolImplementations§
Source§impl Checkbox
impl Checkbox
pub fn new(checked: bool) -> Self
pub fn label(self, l: impl Into<String>) -> Self
Sourcepub fn on_change(self, f: impl Fn(bool) + Send + Sync + 'static) -> Self
pub fn on_change(self, f: impl Fn(bool) + Send + Sync + 'static) -> Self
Called with the NEW value when the control is toggled (D094).
pub fn indeterminate(self) -> Self
pub fn disabled(self) -> Self
pub fn disabled_if(self, c: bool) -> Self
pub fn size(self, s: f32) -> Self
Trait Implementations§
Source§impl Widget for Checkbox
impl Widget for Checkbox
Source§fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
Measure under
ctx.constraints and return a size within them. Read moreSource§fn children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§fn flex_factor(&self) -> f32
fn flex_factor(&self) -> f32
Flex weight inside Row/Column. Wrappers are transparent by default.
Auto Trait Implementations§
impl !RefUnwindSafe for Checkbox
impl !UnwindSafe for Checkbox
impl Freeze for Checkbox
impl Send for Checkbox
impl Sync for Checkbox
impl Unpin for Checkbox
impl UnsafeUnpin for Checkbox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<W> FocusApi for W
impl<W> FocusApi for W
Source§fn focus_node(self, node: FocusNode) -> WithFocus<Self>
fn focus_node(self, node: FocusNode) -> WithFocus<Self>
Attach a focus node. This enables focus-ring rendering and explicit
neighbor wiring.