GitHub Stars

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.

Installation

npx shadcn@latest add @fulldev/radio-group

Usage

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

Composition

Use the following composition to build a RadioGroup:

RadioGroup
├── RadioGroupItem
└── RadioGroupItem

Examples

With Descriptions

Radio group items with a title and supporting copy using the Field component.

Basic features for personal projects.

Advanced tooling for growing teams.

Grid Layout

Wrap the whole row in FieldLabel when you want the entire card to act as the click target.

With FieldSet

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

Notifications

Choose how you want to be notified.

Disabled

Use the disabled prop on RadioGroupItem to disable individual items.

API Reference

See the GitHub source code for more information on props. See the data-slot docs for more information on interactivity.