Radio
Terminal-style radio button group for single selection from multiple options.
Import
Basic Usage
Props
RadioGroup Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Selected value (controlled) |
defaultValue | string | — | Default selected value (uncontrolled) |
onValueChange | (value: string) => void | — | Callback when value changes |
name | string | — | Name attribute for forms |
disabled | boolean | false | Whether the entire group is disabled |
children* | React.ReactNode | — | Radio components |
className | string | — | Additional CSS class names |
ref | React.Ref<HTMLDivElement> | — | Forwarded ref to the container |
Radio Props
| Prop | Type | Default | Description |
|---|---|---|---|
value* | string | — | Value of this radio option |
label | string | — | Label text displayed next to radio |
disabled | boolean | false | Whether this option is disabled |
className | string | — | Additional CSS class names |
ref | React.Ref<HTMLButtonElement> | — | Forwarded ref to the button |
Horizontal Layout
Disabled Options
Controlled RadioGroup
Selected: option1
Pricing Plans Example
Visual Design
The radio uses a terminal-style indicator:
- Unselected:
( ) - Selected:
(*)
Keyboard Navigation
| Key | Action |
|---|---|
Arrow Down / Arrow Right | Select next option |
Arrow Up / Arrow Left | Select previous option |
Tab | Move focus to/from radio group |
Accessibility
- Built on Base UI's accessible radio primitive
- Proper ARIA attributes for screen readers
- Keyboard navigable within group
- Labels properly associated with radio buttons
Styling
| Variable | Description |
|---|---|
--theme-border | Radio border color |
--theme-text | Indicator and label color |
--theme-focused-border | Border color when focused |