import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
export default function RadioGroupDemo() {
return (
<RadioGroup defaultValue="comfortable" className="gap-3">
<div className="flex items-center gap-3">
<RadioGroupItem value="default" id="radio-default" />
<Label htmlFor="radio-default">Default</Label>
</div>
<div className="flex items-center gap-3">
<RadioGroupItem value="comfortable" id="radio-comfortable" />
<Label htmlFor="radio-comfortable">Comfortable</Label>
</div>
<div className="flex items-center gap-3">
<RadioGroupItem value="compact" id="radio-compact" />
<Label htmlFor="radio-compact">Compact</Label>
</div>
</RadioGroup>
)
}
Installation
npx logic2b@latest add radio-group
Usage
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
<RadioGroup defaultValue="comfortable">
<RadioGroupItem value="default" id="r1" />
<RadioGroupItem value="comfortable" id="r2" />
</RadioGroup>