Skip to main content
← All Demos

Radio

Radio lets users choose a single option from a predefined set.

1. Basic Radio Group (Vertical)

Tab into the group, then use arrow keys to navigate and select. Only one item can be selected at a time.

<Radio.Root defaultValue='blue' aria-label='Favorite color'>
  <Radio.Item value='red' id='red' />
  <Label htmlFor='red'>Red</Label>
  <Radio.Item value='blue' id='blue' />
  <Label htmlFor='blue'>Blue</Label>
</Radio.Root>

2. Controlled Radio Group

Parent manages selected value. External buttons can change the selection.

const [value, setValue] = useState(undefined);

<Radio.Root value={value} onChange={(nextValue) => setValue(nextValue)} aria-label='Billing cycle'>
  <Radio.Item value='monthly' id='monthly' />
  <Label htmlFor='monthly'>Monthly</Label>
</Radio.Root>

3. Disabled Radio Items

Individual items can be disabled. Arrow key navigation skips disabled items.

Expected: Arrow keys skip "Pro (sold out)".
<Radio.Root aria-label='Plan selection'>
  <Radio.Item value='free' id='plan-free' />
  <Label htmlFor='plan-free'>Free</Label>
  <Radio.Item value='pro' id='plan-pro' disabled />
  <Label htmlFor='plan-pro' disabled>Pro (sold out)</Label>
</Radio.Root>

4. Fully Disabled Group

Entire group disabled via root disabled prop.

<Radio.Root disabled aria-label='Disabled group'>
  <Radio.Item value='opt-a' id='opt-a' />
  <Label htmlFor='opt-a' disabled>Option A</Label>
</Radio.Root>

5. Required Radio Group

Radio group with required prop. Uses aria-required.

Preferred contact method *
<Radio.Root required aria-label='Preferred contact method'>
  <Radio.Item value='email' id='req-email' />
  <Label htmlFor='req-email'>Email</Label>
</Radio.Root>

6. Select on Focus vs Manual Selection

selectOnFocus={true} (default): Arrow keys move AND select. selectOnFocus={false}: Arrow keys only move focus, Space/Enter selects.

Auto-select (default):

Manual select:

Auto: Arrow keys move + select | Manual: Arrows move focus only, Space selects
<Radio.Root aria-label='Auto select demo'>
  <Radio.Item value='A' id='auto-A' />
  <Label htmlFor='auto-A'>A</Label>
</Radio.Root>

<Radio.Root selectOnFocus={false} aria-label='Manual select demo'>
  <Radio.Item value='X' id='manual-X' />
  <Label htmlFor='manual-X'>X</Label>
</Radio.Root>
← All Demos