Radio Group
A set of checkable buttons—known as radio buttons—where no more than one button can be checked at a time.
Installation
npx neobrutal add radio-group
Usage
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"import { Label } from "@/components/ui/label"
<RadioGroup defaultValue="option-one"><div className="flex items-center gap-2"><RadioGroupItem value="option-one" id="option-one" /><Label htmlFor="option-one">Option One</Label></div><div className="flex items-center gap-2"><RadioGroupItem value="option-two" id="option-two" /><Label htmlFor="option-two">Option Two</Label></div></RadioGroup>
Props
RadioGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | string | - | The value of the radio item that should be checked by default. |
| value | string | - | The controlled value of the radio item to check. |
| onValueChange | (value: string) => void | - | Event handler called when the value changes. |
| disabled | boolean | - | When true, prevents the user from interacting with the radio group. |
RadioGroupItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | The value given as data for the radio item when submitted in a form. |
| disabled | boolean | - | When true, prevents the user from interacting with the radio item. |
| required | boolean | - | When true, indicates that the user must check the radio item before the owning form can be submitted. |