Installation
pnpm dlx shadcn@latest add https://neobrutalism.dev/r/radio-group.jsonUsage
import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'<RadioGroup defaultValue="comfortable">
<div className="flex items-center space-x-2">
<RadioGroupItem value="default" id="r1" />
<Label htmlFor="r1">Default</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="comfortable" id="r2" />
<Label htmlFor="r2">Comfortable</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="compact" id="r3" />
<Label htmlFor="r3">Compact</Label>
</div>
</RadioGroup>Examples
Default
Description
Radio group items with a description using the Field component.
Standard spacing for most use cases.
More space between elements.
Minimal spacing for dense layouts.
Choice Card
Use FieldLabel to wrap the entire Field for a clickable card-style selection.
Fieldset
Use FieldSet and FieldLegend to group radio items with a label and description.
Disabled
Use the disabled prop on a RadioGroupItem to disable a single item, or on RadioGroup to disable all of them. Add data-disabled to the surrounding Field to dim its label.
Invalid
Use aria-invalid on RadioGroupItem and data-invalid on Field to show validation errors.