Skip to content

RadioGroup

Two components: RadioGroup (the container) and Radio (individual options). Built on React Aria’s RadioGroup and Radio primitives with full keyboard and screen reader support.

Terminal window
npx @a2ra/cli add radio
{
"type": "RadioGroup",
"props": {
"label": "Subscription plan",
"name": "plan",
"defaultValue": "monthly",
"orientation": "horizontal"
},
"children": [
{ "type": "Radio", "props": { "value": "monthly", "label": "Monthly" } },
{ "type": "Radio", "props": { "value": "annual", "label": "Annual" } },
{ "type": "Radio", "props": { "value": "lifetime", "label": "Lifetime" } }
]
}
PropTypeDescription
labelstringGroup label
valuestringControlled selected value
defaultValuestringUncontrolled default
orientationhorizontal
vertical default
Layout direction
isDisabledtrue
false default
Disables all radios
isRequiredtrue
false default
Marks group as required
isReadOnlytrue
false default
Prevents selection changes
isInvalidtrue
false default
Shows error styling
validationBehavioraria default
native
Validation strategy
namestringForm field name
descriptionstringHelper text
errorMessagestringError text when isInvalid is true
childrennode[]Radio child nodes
PropTypeDescription
valuestringThe value submitted when this radio is selected (required)
labelstringVisible label text
isDisabledtrue
false default
Disables just this option
  • Radio.value is required. The RadioGroup uses it to track and submit the selection.
  • Arrow keys move focus between options; Space selects the focused option.
  • Only one Radio per group can be selected at a time.