DS0
Components

RadioGroup

A set of mutually exclusive options where the user selects exactly one.

Overview

RadioGroup presents a set of mutually exclusive options where the user can select exactly one. All options are visible simultaneously, making it ideal for 2–5 choices where users need to compare options side by side.

Size

Usage

  <RadioGroup label="Favorite fruit" defaultValue="apple">
    <RadioGroup.Item value="apple" label="Apple" />
    <RadioGroup.Item value="banana" label="Banana" />
    <RadioGroup.Item value="cherry" label="Cherry" />
  </RadioGroup>

export function Example() {
  return (
    <RadioGroup label="Favorite fruit" defaultValue="apple">
      <RadioGroup.Item value="apple" label="Apple" />
      <RadioGroup.Item value="banana" label="Banana" />
      <RadioGroup.Item value="cherry" label="Cherry" />
    </RadioGroup>
  );
}

Orientation

Vertical (default)

  <RadioGroup label="Plan" defaultValue="free">
    <RadioGroup.Item value="free" label="Free" />
    <RadioGroup.Item value="pro" label="Pro" />
  </RadioGroup>

Horizontal

  <RadioGroup label="Size" defaultValue="md" orientation="horizontal">
    <RadioGroup.Item value="sm" label="Small" />
    <RadioGroup.Item value="md" label="Medium" />
    <RadioGroup.Item value="lg" label="Large" />
  </RadioGroup>

With Descriptions

  <RadioGroup label="Notification" defaultValue="email">
    <RadioGroup.Item value="email" label="Email" description="Get notified via email" />
    <RadioGroup.Item value="sms" label="SMS" description="Get notified via text" />
  </RadioGroup>

States

Disabled

  <RadioGroup label="Plan" defaultValue="free" isDisabled>
    <RadioGroup.Item value="free" label="Free" />
    <RadioGroup.Item value="pro" label="Pro" />
  </RadioGroup>

Invalid

  <RadioGroup label="Agreement" isInvalid isRequired errorMessage="Please select an option">
    <RadioGroup.Item value="agree" label="I agree" />
    <RadioGroup.Item value="disagree" label="I disagree" />
  </RadioGroup>

Accessibility

Keyboard Interactions

KeyAction
TabMoves focus into the group (to selected or first item)
Arrow Down / RightSelects and focuses next item
Arrow Up / LeftSelects and focuses previous item
SpaceSelects the focused item

Screen Reader

  • Group is announced with its label and radiogroup role
  • Each item announces its label, checked state, and position

ARIA

  • Container: role="radiogroup", aria-orientation, aria-labelledby
  • Items: role="radio", aria-checked, roving tabIndex

API Reference

RadioGroup Props

PropTypeDefaultDescription
labelstringAccessible label (required)
valuestringControlled value
defaultValuestringUncontrolled default
onValueChange(value: string) => voidChange handler
orientation'vertical' | 'horizontal''vertical'Layout direction
isDisabledbooleanfalseDisables all items
isRequiredbooleanfalseRequired
isInvalidbooleanfalseError state
errorMessagestringError message

RadioGroup.Item Props

PropTypeDefaultDescription
valuestringValue (required)
labelstringVisible label (required)
descriptionstringDescription text
isDisabledbooleanfalseDisables this item

AI Decision Guide

Use RadioGroup when:

  • Selecting one option from 2–5 mutually exclusive choices
  • All options should be visible simultaneously

Don't use RadioGroup when:

  • More than 5 options → use Select
  • Multi-select → use Checkbox group
  • Binary on/off → use Switch
  • Select — Use for 6+ options in a dropdown
  • Checkbox — Use for multi-select
  • Switch — Use for binary toggles

On this page