Radio Group
Accessible single-selection control for mutually exclusive choices.
RadioGroup is built on Radix UI, so it ships with controlled and uncontrolled state, roving focus, and arrow-key navigation out of the box while keeping the glass-ui visual style.
Use it when the user must pick exactly one option from a short list. For independent on/off choices, reach for Checkbox or Switch instead.
Installation
npx @glass-ui-kit/cli add radio-groupUsage
Examples
Default
Pair each RadioGroupItem with a Label using id and htmlFor so the full row stays easy to target.
Disabled states
Disable the whole group when the choice is informative only, or disable a single item when one option is temporarily unavailable.
Group disabled
Item disabled
Controlled
Use value and onValueChange when a parent component owns the selection state.
Styling
Keep the control styling simple and consistent. Reach for size and standard Radix props first, then use className for layout adjustments around the group.
API Reference
RadioGroup accepts all Radix RadioGroup.Root props.
| Prop | Type |
|---|---|
orientation | "vertical" | "horizontal" |
value | string |
defaultValue | string |
onValueChange | (value: string) => void |
disabled | boolean |
required | boolean |
name | string |
className | string |
RadioGroupItem accepts all Radix RadioGroup.Item props.
| Prop | Type |
|---|---|
size | "sm" | "md" | "lg" |
value | string |
disabled | boolean |
id | string |
className | string |
Keyboard support follows native radio-group expectations: Tab moves in and out of the group, while arrow keys move the active selection.