Radio

Radio

Markdown

A grouped control for choosing exactly one option from a small visible set.

Use Radio when seeing every option helps comparison and only one may be selected. Use Select or Combobox for longer lists.

Plan

Plan selection

Installation

$npx shadcn@latest add @patchui/radio

The copied source is available in the registry JSON. The canonical implementation lives in packages/react/src/components/radio.tsx.

Usage

<RadioGroup aria-label="Billing cycle" defaultValue="monthly">
  <Radio value="monthly">Monthly</Radio>
  <Radio value="yearly">Yearly</Radio>
</RadioGroup>

Pass label text as Radio children to make the complete row selectable. Every value must be unique within its RadioGroup.

Composition

RadioGroup
└── Radio

Examples

Unavailable option

Disable an individual Radio when the option remains useful context but cannot currently be selected. Disable the group when no choices are available.

Data region

Unavailable option

API reference

PropTypeDefaultDescription
RadioGroup.value / onValueChangestring / (value, details) => void-Controls the selected value.
RadioGroup.defaultValuestring-Sets the initial uncontrolled selection.
RadioGroup.namestring-Names the submitted form value.
RadioGroup.requiredbooleanfalseRequires one option before form submission.
RadioGroup.disabledbooleanfalseDisables every option in the group.
Radio.valuestring-Identifies the option within its group.
Radio.childrenReactNode-Adds a visible label and expands the selectable target.

Radio also accepts disabled for one unavailable option. Bare radios are supported for custom layouts but require a specific accessible name.

Accessibility

  • Give every RadioGroup an accessible name with visible labeling through aria-labelledby or a concise aria-label.
  • Use Radio children for visible option labels. Do not rely on color or position alone.
  • Tab enters or leaves the group. Arrow keys move selection between enabled options.
  • Preselect the safest reasonable default. Omit a default when the decision must be deliberate.
  • Keep the visible list small enough to compare without excessive keyboard movement.