Skip to content

Toggle

A boolean switch: [ o] on, [o ] off (the knob slides). Enter or Space toggles it when focused, as does a click. Like Checkbox, controlled via onChanged. Passing null disables it.

See also: Checkbox for a checklist item · 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.

Toggle(
value: _compact,
label: 'Compact rows',
onChanged: (value) => setState(() => _compact = value),
)
ParameterTypeDefaultDescription
value:boolrequiredControlled on/off state rendered by the toggle.
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 toggle requests focus when mounted.
style:CellStyle?—Base styling, plus optional hover, focus, selected, disabled, and invalid state entries from CellStyle.interactive.

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

Category: Inputs & controls · All widgets