Radio group

Picks exactly one of a few options you can see at once.

Usage

pnpm dlx shadcn@latest add radio-group

Then replace components/ui/radio-group.tsx with the Matrix version. It keeps shadcn's API (value, onValueChange, defaultValue) and adds the Matrix sizes and look.

import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
import { Field, FieldLabel } from '@/components/ui/field';

<RadioGroup defaultValue="monthly" aria-label="Billing">
  <Field orientation="horizontal">
    <RadioGroupItem value="monthly" id="monthly" />
    <FieldLabel htmlFor="monthly">Monthly</FieldLabel>
  </Field>
  <Field orientation="horizontal">
    <RadioGroupItem value="yearly" id="yearly" />
    <FieldLabel htmlFor="yearly">Yearly</FieldLabel>
  </Field>
</RadioGroup>

The group handles the rest: one option selected at a time, one tab stop, arrow keys to move.

Variants

Unselected
Selected

States

Focus, disabled and invalid
Focus
Disabled · on
Disabled · off
Invalid

Sizes

sm · md
sm · 16px, 6px dot (default)
md · 20px, 8px dot

With labels

Labels and descriptions
When an agent finishes

Which control

The list is…UseWhy not the others
2–5 visible options, pick oneRadio groupEvery option is readable at once, so people compare instead of search.
A long or searchable list, pick oneSelect or comboboxA radio list you have to scroll stops being comparable.
Several independent optionsCheckboxA radio group can never mean "two of these".
A setting that applies immediatelySwitchRadios belong to a form that's saved.
Inside a dropdown menuNever a radioThe menu owns the arrow keys; use a menu item with a check.

Behavior

The group is one tab stop

Tab enters the group once, on the selected option (or the first one). Arrow keys then move and select, skipping disabled options and wrapping at the ends.

Space selects; Enter doesn't

Enter is left for submitting the form.

Give the group a name

Label the group with a FieldLegend inside a FieldSet, or aria-label on RadioGroup, so screen readers announce what the choice is about.

API reference

RadioGroup

Prop

Type

RadioGroupItem

Prop

Type

Guidelines

  • Use radios for 2–5 options people should compare at a glance.
  • Select a sensible default when one exists, so the group never starts empty without reason.
  • Order options logically: most common first, or a natural order (small to large).
  • Don't use a single radio on its own; it can't be unselected. Use a checkbox.
  • Don't put radios inside a dropdown menu.