Skip to content

Checkbox

A boolean checkbox: [x] checked, [ ] unchecked. Enter or Space toggles it when focused, as does a click, calling onChanged with the new value. A controlled widget — hold the value yourself and update it from onChanged. Passing null disables it.

See also: Toggle for a compact on/off switch · Switch for a setting that should stand out.

Learn more: Forms & validation

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

Checkbox(
value: _accepted,
label: 'Accept terms',
onChanged: (value) => setState(() => _accepted = value),
)
ParameterTypeDefaultDescription
value:boolrequiredControlled checked state rendered by the checkbox.
onChanged:void Function(bool value)?requiredCalled with the requested next state on activation; null disables it.
label:String?—Optional visible text and semantic label beside the indicator.
focusNode:FocusNode?—Optional externally owned focus node used for activation.
autofocus:boolfalseWhether the checkbox requests focus when mounted.
style:CellStyle?—Base styling, plus optional hover, focus, selected, disabled, and invalid state entries from CellStyle.interactive.

Checkbox is defined in packages/fleury/lib/src/catalog/controls.dart.

Category: Inputs & controls · All widgets