⌂
›
Widgets
›
Checkbox
Checkbox
A boolean input control for toggled state.
Example
checkbox(
label: "Enable notifications",
value: true
)
Common properties
labelvalueon_changedisabled
Usage
checkbox(
label: "I agree",
value: accepted,
on_change: ->(event) { accepted = event.value }
)
Notes
on_changeis used when the checked state should update app state
Complete API
Helpers
checkbox(**props)
Accepted properties
active_color— Active color.adaptive— Adapts to the platform (Material/Cupertino) when true.align— Alignment of the control within its parent.animate_align— Animates alignment changes.animate_margin— Animates margin changes.animate_offset— Animates offset changes.animate_opacity— Animates opacity changes.animate_position— Animates position changes.animate_rotation— Animates rotation changes.animate_scale— Animates scale changes.animate_size— Animates size changes.aspect_ratio— Width-to-height ratio to maintain.autofocus— Requests focus when first shown.badge— Badge drawn on the corner of the control.border_side— Sets the border side property.bottom— Bottom offset when positioned inside a stack.check_color— Check color.col— Responsive column span (1-12) per breakpoint.data— Arbitrary value you can attach to the control and read back in handlers.disabled— Disables interaction when true.error— Sets the error property.expand— Fills the available space along the parent's main axis when true.expand_loose— Like expand, but only grows up to the child's natural size.fill_color— Fill color.focus_color— Color shown while focused.height— Fixed height in logical pixels.hover_color— Color shown while hovered.key— Stable identity used to preserve state across rebuilds.label— Text label shown for the control.label_position— Sets the label position property.label_style— Label style.left— Left offset when positioned inside a stack.margin— Outer spacing around the control.mouse_cursor— Cursor shown when hovering the control.offset— Translation offset applied to the control.opacity— Opacity from 0.0 (transparent) to 1.0 (opaque).overlay_color— Overlay color.right— Right offset when positioned inside a stack.rotate— Rotation applied to the control.rtl— Renders right-to-left when true.scale— Scale transform applied to the control.semantics_label— Sets the semantics label property.shape— Shape/border of the control.size_change_interval— Throttle interval for on_size_change, in ms.splash_radius— Splash radius.tooltip— Text shown on hover/long-press.top— Top offset when positioned inside a stack.tristate— Sets the tristate property.value— The control's current value.visible— Hides the control when false.visual_density— Compactness of the control's layout.width— Fixed width in logical pixels.
Events
on_animation_end— Fired when an animation completes.on_blur— Fired when the control loses focus.on_change— Fired when the value changes.on_focus— Fired when the control gains focus.on_size_change— Fired when the control's size changes.
Wire reference
- Family:
materials - Widget type:
checkbox