Radio Group
Picks exactly one option from a short list. The dot springs in from the center, and arrow keys move the selection.
Install
npx shadcn@latest add @nelumbo/radio-groupBasic
Wrap each item and its text in a label so the whole line is clickable.
default
brand, with a disabled option
As cards
For choices that need more than a word. The whole card is the label; the selected card gets a stronger border.
Usage
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"<RadioGroup value={plan} onValueChange={setPlan} aria-label="Plan"> <label className="flex items-center gap-3"> <RadioGroupItem value="free" /> Free </label> <label className="flex items-center gap-3"> <RadioGroupItem value="pro" /> Pro </label></RadioGroup>Props
RadioGroup takes Radix Radio Group props (value, defaultValue, onValueChange, orientation…).
| Prop | Type | Default | Notes |
|---|---|---|---|
Item: value | string | required | |
Item: color | "default" | "brand" | "default" | |
Item: aria-invalid | boolean | Error color |