Skip to main content

Radio

A single radio button control with an optional text label.

When to use it

Use a Radio to let the user pick a single option from a set — typically several Radio widgets are grouped together, with the calling code tracking which one is selected. Pass null for onSelected to render the button as disabled.

Import

import 'package:catalyst_ui/catalyst_ui.dart';

Usage

Radio(
value: selectedOption == 'a',
label: const Text('Option A'),
onSelected: (_) => setState(() => selectedOption = 'a'),
)

Parameters

ParameterTypeDefaultDescription
valueboolrequiredWhether this radio button is currently selected.
labelWidget?nullAn optional label rendered to the right of the control.
sizeRadioSizeRadioSize.mediumThe size variant.
onSelectedValueChanged<bool>?nullCalled when the user selects this radio button.
trailingRadioboolfalseIf true, the radio icon will appear at the end of the widget.
fullWidthboolfalseIf true, the Radio will expand to fill all available horizontal space. Otherwise, it will be as small as the label allows.

Sizes

RadioSize values: small (16px), medium (20px, default), large (24px).

RadioIndicator

RadioIndicator is the standalone circular indicator used internally by Radio to render the selected/unselected state. It can be used directly when building a custom radio-group layout.

ParameterTypeDefaultDescription
valueboolrequiredWhether the option is selected.
sizeRadioSizeRadioSize.mediumThe size of this indicator.