Radio
A headless radio button component that provides accessible, single-selection functionality. Radio buttons allow users to select exactly one option from a set of choices.Features
- Single-selection: Only one radio can be selected at a time within a group
- Keyboard navigation: Arrow keys navigate between options with roving tabindex
- Activation modes: Automatic (selection follows focus) or manual (requires Enter/Space)
- Full accessibility: ARIA radiogroup pattern with proper roles and states
- Form integration: Automatic hidden input generation for native form submission
- Flexible rendering: Works with any element via
asprop or renderless mode
Basic Usage
Components
Radio.Group
Container for managing radio buttons with single-selection behavior.The currently selected value
Form field name shared by all radios. Enables native form submission
Disables all radio buttons in the group
false: Selection can be cleared (not typical for radios)true: Selection cannot be cleared once set'force': Auto-selects first non-disabled item on mount
'automatic': Arrow keys change selection (ARIA standard)'manual': Arrow keys only move focus, Enter/Space to select
Accessible name for the radio group
HTML element to render as
Render only slot content without wrapper
Context namespace for child radios
Slot Props
Whether the group is disabled
Whether no radio is selected
Current activation mode
Pre-computed ARIA attributes including
role="radiogroup"Radio.Root
Individual radio button component. Must be used withinRadio.Group.
Value associated with this radio button
Disables this specific radio button
Optional display label (passed to slot props)
Unique identifier (auto-generated if not provided)
Associate with a form element by ID
HTML element to render as
Render only slot content without wrapper
Context namespace for child components
Namespace for connecting to parent group
Slot Props
Whether this radio is selected
Whether this radio is disabled
Function to select this radio
Pre-computed ARIA and data attributes including:
role="radio"aria-checkedtabindex(roving tabindex: 0 for selected/first, -1 for others)data-state="checked" | "unchecked"
Radio.Indicator
Visual indicator that displays when the radio is selected.HTML element to render as
Render only slot content without wrapper
Context namespace to inject from parent
Slot Props
Whether the radio is selected
Contains
data-state and visibility styleThe indicator is automatically hidden via
visibility: hidden when the radio is not selected.Radio.HiddenInput
Hidden input for native form submission. Automatically rendered whenname prop is provided to Radio.Group.
Form field name (inherited from group if not provided)
Value to submit (overrides context value)
Associate with form by ID (overrides context form)
Context namespace to inject from parent
Advanced Examples
Manual Activation Mode
In manual mode, arrow keys only move focus. Users must press Enter or Space to actually change the selection. This is useful for toolbar radio groups where you want deliberate selection.
Mandatory Selection
Renderless Mode
Disabled Options
Accessibility
ARIA Radiogroup Pattern
The Radio component implements the WAI-ARIA radiogroup pattern:- Uses
role="radiogroup"on the group container - Uses
role="radio"andaria-checkedon each radio button - Implements roving tabindex for keyboard navigation
- Only one radio is tabbable at a time (selected radio, or first if none selected)
Keyboard Navigation
- Tab: Moves focus into/out of the radio group
- Arrow keys: Navigate between radio buttons
- In automatic mode: Selects the focused radio
- In manual mode: Only moves focus
- Space/Enter: Selects the focused radio (always works in both modes)
Screen Reader Support
- Group announces as “radiogroup” with optional label
- Each radio announces its label, checked state, and position
- Disabled radios are announced as “disabled”
Type Safety
All components are fully typed with TypeScript generics:Comparison with Other Components
| Component | Selection | Use Case |
|---|---|---|
| Radio | Single, mandatory | One choice from mutually exclusive options |
| Checkbox | Multiple, optional | Multiple independent choices |
| Switch | Single boolean | On/off toggle state |
| Select | Single or multiple | Large lists with search/filtering |