Radio Group

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

Loading example…

Installation

bunx --bun shadcn@latest add @sui/radio-group

Install with the shadcn CLI or use the shared @workspace/ui package. Follow the installation guide to configure the registry, load styles, and choose import aliases.

Usage

import { Label } from "@workspace/ui/components/label"
import { RadioGroup, RadioGroupItem } from "@workspace/ui/components/radio-group"
<RadioGroup defaultValue="option-one">
  <div className="flex items-center gap-3">
    <RadioGroupItem value="option-one" id="option-one" />
    <Label htmlFor="option-one">Option One</Label>
  </div>
  <div className="flex items-center gap-3">
    <RadioGroupItem value="option-two" id="option-two" />
    <Label htmlFor="option-two">Option Two</Label>
  </div>
</RadioGroup>

Composition

Use the following composition to build a RadioGroup:

RadioGroup
├── RadioGroupItem
└── RadioGroupItem

Description

Radio group items with a description using the Field component.

Loading example…

Choice Card

Use FieldLabel to wrap the entire Field for a clickable card-style selection.

Loading example…

Fieldset

Use FieldSet and FieldLegend to group radio items with a label and description.

Loading example…

Disabled

Use the disabled prop on RadioGroup to disable all items.

Loading example…

Invalid

Use aria-invalid on RadioGroupItem and data-invalid on Field to show validation errors.

Loading example…

RTL

To enable RTL support in shadcn/ui, see the RTL configuration guide.

Loading example…

API Reference

See the Base UI Radio Group documentation.