Radio lets users choose a single option from a predefined set.
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>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>Individual items can be disabled. Arrow key navigation skips disabled items.
<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>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>Radio group with required prop. Uses aria-required.
<Radio.Root required aria-label='Preferred contact method'>
<Radio.Item value='email' id='req-email' />
<Label htmlFor='req-email'>Email</Label>
</Radio.Root>selectOnFocus={true} (default): Arrow keys move AND select. selectOnFocus={false}: Arrow keys only move focus, Space/Enter selects.
Auto-select (default):
Manual select:
<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>