Skip to content

RadioGroup

Coordinates a set of Radio children into a single-select group with roving tabindex.

  • stable
  • since v0.1.0
  • 1.96 kB
  • forms

role="radiogroup" with arrow-key roving focus; Tab enters and leaves the group.

Preview
Open
tsx

Set orientation to "horizontal" to lay out radios in a row (default is "vertical").

Preview
Open
tsx

Pass value and onValueChange to drive the selection from parent state.

Preview
Open
tsx

Disable the entire group with disabled.

Preview
Open
tsx
PropTypeDefaultDescription
value
string
Controlled selected radio value.
defaultValue
string
Uncontrolled initial selected value.
onValueChange
((value: string) => void)
Fires with the next value on selection change.
name
string
Submitted form field name shared across every radio in the group.
disabled
boolean
Disables every radio in the group.
required
boolean
Marks the field as required for form submission.
orientation
"horizontal"|"vertical"
vertical
Layout direction. Affects arrow-key navigation.
aria-label
string
`aria-label` for the group when no visible label is provided.
aria-labelledby
string
`aria-labelledby` — typically the id of a companion `<Label>`.
id
string
className
string
  • Renders role="radiogroup" — supply an aria-label or aria-labelledby for assistive tech.
  • Arrow Up/Down (vertical) or Arrow Left/Right (horizontal) moves selection between radios.
  • Tab enters the group at the currently-selected (or first) radio and leaves on the next Tab.
  • Setting required on the group marks the field required for form submission.
  • Use for mutually exclusive options like pricing tiers, shipping methods, or sort order.
  • For 5+ options or long labels, consider Select or Combobox instead.
  • Pair with a Label + aria-labelledby when you need a visible caption.