Skip to content

RadioGroup

A controlled group of Radios: hold the selected value and update it from onChanged.

See also: Radio to lay out each choice yourself.

Learn more: Forms & validation

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

RadioGroup<String>(
value: _mode,
options: const <RadioOption<String>>[
RadioOption(value: 'fast', label: 'Fast'),
RadioOption(value: 'safe', label: 'Safe'),
],
onChanged: (value) => setState(() => _mode = value),
)

The arrow keys move focus and selection together to the adjacent enabled option, wrapping at the ends: Up or Left selects the previous option, and Down or Right the next, in either axis. Each radio is also its own Tab stop, and Enter, Space, or a click selects it.

ParameterTypeDefaultDescription
value:T?requiredThe currently selected value.
onChanged:void Function(T value)?requiredCalled with the new value when the user moves or activates a radio. Passing null disables the whole group.
options:List<RadioOption<T>>requiredOrdered choices; disabled options remain visible but navigation skips them.
axis:AxisAxis.verticalWhether options are stacked vertically or laid out in one row. All four directional arrows navigate in either layout.
spacing:int2Horizontal gap between options when axis is horizontal.
semanticLabel:String'Radio group'Label exposed for the group through the semantic app graph.
autofocus:boolfalseWhether the selected enabled radio, or first enabled option, requests initial focus.
style:CellStyle?—Base styling for every radio, plus optional hover, focus, selected, disabled, and invalid state entries from CellStyle.interactive.

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

Category: Inputs & controls · All widgets