Loading...
Loading...
The Radio Group component allows users to select a single option from a set of mutually exclusive options. Perfect for forms, surveys, and single-choice scenarios.
Selected: None
Select your preferred Italian region
import { RadioGroupRoot, RadioGroupItem, RadioGroupLabel } from '@/components/ui/radio-group';
// Basic radio group
<RadioGroupRoot value={value} onValueChange={({ value }) => setValue(value)}>
<div className="flex items-center space-x-2">
<RadioGroupItem value="option1" id="radio1" />
<RadioGroupLabel htmlFor="radio1">Option 1</RadioGroupLabel>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="option2" id="radio2" />
<RadioGroupLabel htmlFor="radio2">Option 2</RadioGroupLabel>
</div>
</RadioGroupRoot>
// Horizontal layout
<RadioGroupRoot orientation="horizontal" defaultValue="option1">
{/* ... */}
</RadioGroupRoot>
// Different sizes
<RadioGroupRoot size="sm"> {/* xs, sm, md, lg */}
{/* ... */}
</RadioGroupRoot>