Components
Radio Group
Accessible group of mutually exclusive radio controls with expressive spring dot animation and state layers.
import { Radio, RadioGroup } from "@/components/ui/radio-group";
export default function Particle() {
return (
<RadioGroup defaultValue="comfortable">
<label className="flex cursor-pointer items-center gap-2.5 text-sm">
<Radio value="compact" />
<span>Compact</span>
</label>
<label className="flex cursor-pointer items-center gap-2.5 text-sm">
<Radio value="comfortable" />
<span>Comfortable</span>
</label>
<label className="flex cursor-pointer items-center gap-2.5 text-sm">
<Radio value="spacious" />
<span>Spacious</span>
</label>
</RadioGroup>
);
}
Installation
pnpm dlx shadcn@latest add @taut-ui/radio-group
Usage
import { Radio, RadioGroup } from "@/components/ui/radio-group"<RadioGroup defaultValue="a">
<label className="flex items-center gap-2.5 text-sm">
<Radio value="a" />
<span>Option A</span>
</label>
<label className="flex items-center gap-2.5 text-sm">
<Radio value="b" />
<span>Option B</span>
</label>
</RadioGroup>Examples
With Descriptions
import { Radio, RadioGroup } from "@/components/ui/radio-group";
const plans = [
{
description: "Essential tools for personal projects.",
label: "Starter",
value: "starter",
},
{
description: "Collaboration and analytics for growing teams.",
label: "Pro",
value: "pro",
},
{
description: "Custom limits, SSO, and dedicated support.",
label: "Enterprise",
value: "enterprise",
},
];
export default function Particle() {
return (
<RadioGroup className="w-full max-w-xs gap-3.5" defaultValue="pro">
{plans.map((plan) => (
<label
className="flex cursor-pointer items-start gap-3"
key={plan.value}
>
<Radio className="mt-0.5" value={plan.value} />
<span className="flex flex-col gap-0.5">
<span className="font-medium text-foreground text-sm leading-5">
{plan.label}
</span>
<span className="text-muted-foreground text-xs leading-4">
{plan.description}
</span>
</span>
</label>
))}
</RadioGroup>
);
}
Card Selection
import {
Card,
CardAction,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Radio, RadioGroup } from "@/components/ui/radio-group";
const options = [
{
description: "Delivered in 3–5 business days",
label: "Standard shipping",
price: "Free",
value: "standard",
},
{
description: "Delivered in 1–2 business days",
label: "Express shipping",
price: "$12",
value: "express",
},
];
export default function Particle() {
return (
<RadioGroup className="w-full max-w-sm gap-2.5" defaultValue="standard">
{options.map((option) => (
<Card
className="w-full cursor-pointer rounded-2xl has-data-checked:bg-[color-mix(in_oklab,var(--color-card),var(--color-primary)_14%)] has-data-checked:shadow-[inset_0_0_0_0.0625rem_var(--color-primary)]"
key={option.value}
orientation="horizontal"
render={<label />}
ripple
>
<Radio value={option.value} />
<CardHeader className="gap-0.5">
<CardTitle className="text-sm leading-5">{option.label}</CardTitle>
<CardDescription className="text-xs leading-4">
{option.description}
</CardDescription>
<CardAction className="font-medium text-foreground text-sm tabular-nums">
{option.price}
</CardAction>
</CardHeader>
</Card>
))}
</RadioGroup>
);
}
Disabled
import { Radio, RadioGroup } from "@/components/ui/radio-group";
export default function Particle() {
return (
<RadioGroup defaultValue="email" disabled>
<label className="flex cursor-not-allowed items-center gap-2.5 text-muted-foreground text-sm">
<Radio value="email" />
<span>Email notifications</span>
</label>
<label className="flex cursor-not-allowed items-center gap-2.5 text-muted-foreground text-sm">
<Radio value="sms" />
<span>SMS notifications</span>
</label>
</RadioGroup>
);
}
API Reference
RadioGroup
Wraps Base UI RadioGroup.
| Prop | Type | Default | Description |
|---|---|---|---|
value | Value | - | Controlled selected value |
defaultValue | Value | - | Initial uncontrolled selected value |
onValueChange | (value: Value, eventDetails) => void | - | Callback fired when the selected option changes |
name | string | - | Field name submitted with a form |
disabled | boolean | false | Disables all radio buttons in the group |
readOnly | boolean | false | Prevents changing the current selection |
required | boolean | false | Marks the group as required for form submission |
Radio
Wraps Base UI Radio.Root (RadioGroupItem is also exported as an alias).
| Prop | Type | Default | Description |
|---|---|---|---|
value | Value | - | Unique value represented by this radio |
disabled | boolean | false | Disables interaction for this radio button |
readOnly | boolean | false | Prevents changing this radio button |