Radio Group

Used for choosing a single option from a set of mutually exclusive choices, like a shipping method or payment option.

Use Radio Group...

  • When exactly one option from a related group can be selected.

Don't use Radio Group...

  • When multiple options can be selected. Use Checkbox Group instead.
  • For selectable buttons, cards, tiles, or color swatches. Use Choice Group instead.
  • Don't use Radio outside of Radio Group.

The preview has been updated.

Disabled

Use disabled on any Radios within Radio Group to prevent them from being selected or deselected.

To disable the entire group, use disabled on each item.

The preview has been updated.

Labels, helpers, and error text

Use the FormField components to add a label, error message, or helper text to a Radio Group. They apply the necessary ARIA attributes for you, so you don't need to add them yourself.

Managing State

Controlled

Use selectedValue and onSelectedValueChange on Radio Group to control the selected value. selectedValue is the value of the currently selected Radio, or an empty string ('') if nothing is selected. onSelectedValueChange receives the newly selected value and the native change event. Update your state in the handler so the group reflects the new selection.

The preview has been updated.

Uncontrolled

Omit selection to allow the browser to manage the state. Optionally, use defaultSelection to set the initially selected values, and/or pass onSelectionChange to react to changes (for example, to track the selection) without taking over the state.

The preview has been updated.

Accessibility

Both Radio Group and Radio must have a localized accessible name.

Radio Group

Use a FormLabel to provide a visible and accessible name (recommended, see Labels, helpers, and error text). Alternatively, use custom ARIA labels (see Accessibility guidelines).

Radio

By default, a Radio is named by its contents, so rich contents (e.g. a product name, image, price, or button) become a long, cluttered name to a screen reader.

To override the default name with a short custom one, use aria-label or aria-labelledby to reuse text from another element (see Accessibility guidelines). If you set both, aria-label wins. The Radio's full contents then become its description (using aria-describedby), so it stays easy to identify without losing information.

Props

See core props for additional props that can be applied to each of these components. Each component also accepts the React-equivalent native HTML attributes of the element it renders, unless a listed prop replaces one or a note says otherwise.
RadioGroup
Renders <div>.
proptyperequireddefault
name
The shared `name` attribute for the group's `Choice` inputs. Optional -- auto-generated if omitted, since radios need a shared `name` for native exclusivity. Not applied when `overrideKeyboardNav` is active -- an `<input type="button">` has no selected value to submit with `FormData`.
string
false
null
selectedValue
The currently selected value, or `''` if nothing is selected. Used when controlling the state of the component.
string
false
null
defaultSelectedValue
The default selected value. Used when not controlling the state of the component.
string
false
null
onSelectedValueChange
Called with the newly selected value and the native radio input's change event.
((selectedValue: string, event: ChangeEvent<HTMLInputElement, Element>) => void)
false
null
Radio
Renders <div>. The ref and selection attributes go to its inner control.
proptyperequireddefault
value
A string representing the value of this choice.
string
true
null

Related