Radio Group
stableA set of checkable buttons where only one can be checked at a time.
Basic usage
Examples
Density selector
Three options with descriptive labels for choosing UI density.
Card radio choices
Use radio items inside larger labels when the option needs supporting copy.
Semantic colors
Color prop on RadioGroup.Item sets the checked-state indicator color.
Features
- Roving focus.
- Controlled or uncontrolled.
Installation
bash
pnpm dlx structyl add radio-groupAPI Reference
RadioGroup.Root
Groups radio items; manages selection and roving focus.
| Prop | Type | Default |
|---|---|---|
| value | stringControlled selected value. | — |
| defaultValue | stringInitial value when uncontrolled. | — |
| onValueChange | (value: string) => voidCalled when the selection changes. | — |
| disabled | booleanDisable the whole group. | false |
| orientation | 'horizontal' | 'vertical'Arrow-key navigation axis. | 'vertical' |
| loop | booleanWhether arrow navigation wraps. | true |
| name | stringName for form submission. | — |
RadioGroup.Item
An individual radio button.
| Prop | Type | Default |
|---|---|---|
| value | stringThe value submitted when selected. | — |
| disabled | booleanDisable this item. | false |