This page as markdown: /radio.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt
Radio
Status: stable
Single-select control over Base UI RadioGroup + Radio (roving focus, arrow-key nav, ARIA radiogroup wiring, form integration). RadioGroup + Radio.
Keywords: radio, radio group, single choice, form control
Usage
Use Radio when a user must choose exactly one option from a visible set.
Best practices
- Do: Use it when all options should be visible for comparison.
- Do: Keep option labels mutually exclusive and easy to understand.
- Don't: Do not use Radio for independent toggles or multiple selection; use Checkbox or Switch. → use Checkbox, Switch
- Don't: Do not use a radio group with only one option, and do not omit the Fieldset. Without the fieldset the options share no accessible name, so a screen reader reads the choices with no question attached.
Anatomy
| Part | Required | Description |
|---|---|---|
| RadioGroup | yes | The grouped set that manages one selected value. |
| Radio | yes | One selectable option in the group. |
Subcomponents
| Name | Type | Description |
|---|---|---|
| RadioGroup | Base UI RadioGroup props (value, defaultValue, onValueChange, name, disabled, readOnly, required) + className | The group container that wraps Radio items and shares selection state across them. Controlled via value + onValueChange; uncontrolled via defaultValue. Lays its Radio items out in a vertical stack. |
Props
| Name | Type | Default | Description |
|---|---|---|---|
| Radio | Base UI Radio.Root props (value, disabled, readOnly, required) + className | — | A single radio button. value pairs it with the group's selected value. Renders a native button with radio semantics, the ring and an inner Indicator dot. A custom non-button render must also set nativeButton={false}. |
Tokens used
input, card, primary, ring
Motion
- arrival · Root · no motion — Radios arrive with the form they belong to. Animating each one in turns a question into a title sequence.
- response · Root ·
motion-interactive— The ring's edge and focus ring ease, so arrowing through a group — which moves the selection with focus — reads as one choice moving down the list. - transition · Indicator ·
motion-interactive— The dot grows from the centre on a spring and shrinks out of the radio being left. A group's selection moves from one option to another, and the paired grow and shrink is what makes it read as moving rather than two dots blinking. - activity · Root · no motion — A radio commits instantly. A slow write belongs to the surrounding form's pending state, not the control.
Accessibility
- Base UI provides the radiogroup/radio roles, aria-checked, hidden native inputs, and roving tabindex.
- Arrow keys move and select between items; Space selects the focused item; Tab enters/leaves the group.
- Checked state styling reads from the data-[checked] attribute; disabled items from the disabled state.
- Focus-visible draws a 2px ring on the focused item. Wrap each Radio in
so the label names it, is part of the hit target, sits on the first line, and dims with it when disabled — do not hand-build a
Related
- Components: Checkbox, RadioCard, Field, Fieldset, Select
Examples
Basic
import { Field, Fieldset, FieldsetContent, FieldsetLegend, Radio, RadioGroup } from "@sableui/react"
<Fieldset>
<FieldsetLegend>Post type</FieldsetLegend>
<FieldsetContent>
<RadioGroup defaultValue="standard">
<Field label="Standard" orientation="horizontal"><Radio value="standard" /></Field>
<Field label="Poll" orientation="horizontal"><Radio value="poll" /></Field>
</RadioGroup>
</FieldsetContent>
</Fieldset>
With a disabled option
import { Field, Fieldset, FieldsetContent, FieldsetLegend, Radio, RadioGroup } from "@sableui/react"
<Fieldset>
<FieldsetLegend>Post type</FieldsetLegend>
<FieldsetContent>
<RadioGroup defaultValue="standard">
<Field label="Standard" orientation="horizontal"><Radio value="standard" /></Field>
<Field label="Poll" orientation="horizontal" disabled><Radio value="poll" /></Field>
</RadioGroup>
</FieldsetContent>
</Fieldset>