Radio Group
A set of visible options that holds one persistent field value.
Usage guidelines
- Use
RadioGroupfor one persistent field value from a small set of options that all stay visible. UseSelectto choose from a closed, scannable list without text entry,SegmentedControlfor one mode, view or filter for content that stays in place, andCheckboxGroupfor several values from a visible set. - Every radio belongs to a
RadioGroup. Do not render a standaloneRadioorRadioItem. - Name the group with
FieldsetandFieldsetLegend, and name each option with its ownFieldLabelinside aFieldItem. Usearia-labelon the group only when no visible legend exists. - Use
Radiofor the standard dot in a form row. UseRadioItemwhen custom content is itself the option, such as a card, and putRadioControlinside it for the indicator.RadioControlis visual only, never a standalone radio. - Keep the caller's value type.
RadioGroup<Value>,Radio<Value>andRadioItem<Value>accept unions, booleans and numbers; JSX children do not inherit the parent's generic, so type each option when its value is not a string. - Pass
disabled,readOnly,value,defaultValueandonValueChangetoRadioGroup, not toFieldset.Fieldsetowns the group semantics and the legend relationship only.
Anatomy
Field gives the group its form name. Fieldset renders the RadioGroup element through render, so the legend names the radiogroup directly.
Examples
Option cards
Make the whole card the radio with RadioItem and render it as a native button. RadioControl draws the dot; point aria-labelledby at the title and aria-describedby at the supporting text so the name stays short.
Typed controlled value
Control the value with value and onValueChange when another part of the page reads it. Here the value is a boolean, typed on the group and on each Radio.
The API returns server-sent events as tokens arrive.
Disabled option
Set disabled on a FieldItem to disable one option and its label. A FieldDescription in the same item explains why. Arrow keys skip the disabled option.
Available for documents under 10,000 tokens.
Keyboard
| Key | Action |
|---|---|
| Tab | Moves focus into the group on the selected radio, then out of the group. |
| Down arroworRight arrow | Moves focus to the next enabled radio and selects it, wrapping at the end. |
| Up arroworLeft arrow | Moves focus to the previous enabled radio and selects it, wrapping at the start. |
API reference
Radio
A styled radio button control for standard form rows; pair with a visible FieldLabel or <label>. Renders a <span> element and a hidden <input> beside.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: RadioRootState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, RadioRootState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: RadioRootState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | false | |
value required | Value | No default | |
disabled | boolean | No default | |
required | boolean | No default | |
readOnly | boolean | No default | |
inputRef | React.Ref<HTMLInputElement> | No default | |
| Attribute | Description |
|---|---|
data-checked | Present when the radio is checked. |
data-unchecked | Present when the radio is not checked. |
data-disabled | Present when the radio is disabled. |
data-readonly | Present when the radio is readonly. |
data-required | Present when the radio is required. |
data-valid | Present when the radio is in a valid state (when wrapped in Field.Root). |
data-invalid | Present when the radio is in an invalid state (when wrapped in Field.Root). |
data-touched | Present when the radio has been touched (when wrapped in Field.Root). |
data-dirty | Present when the radio's value has changed (when wrapped in Field.Root). |
data-filled | Present when the radio is checked (when wrapped in Field.Root). |
data-focused | Present when the radio is focused (when wrapped in Field.Root). |
RadioControl
Renders the standard visual radio indicator inside a custom RadioItem. Renders a <span> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: RadioIndicatorState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, RadioIndicatorState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: RadioIndicatorState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-required | Present when the user must choose a value before submitting a form. |
data-transitionstatus | Values: The transition status of the component. |
data-checked | Present when the radio button is currently selected. |
data-disabled | Present when the component should ignore user interaction. |
data-readonly | Present when the user should be unable to select the radio button. |
data-touched | Present when the radio button has been touched (when wrapped in Field.Root). |
data-dirty | Present when the radio button's value has changed from its initial value (when wrapped in Field.Root). |
data-filled | Present when the radio button has a value (when wrapped in Field.Root). |
data-focused | Present when the radio button is focused (when wrapped in Field.Root). |
RadioGroup
Provides shared single-selection state and keyboard navigation for a series of radio buttons. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
disabled | boolean | false | |
readOnly | boolean | false | |
required | boolean | false | |
name | string | No default | |
form | string | No default | |
value | Value | No default | |
defaultValue | Value | No default | |
onValueChange | ((value: Value, eventDetails: BaseRadioGroup.ChangeEventDetails) => void) | No default | |
inputRef | React.Ref<HTMLInputElement> | No default | |
className | string | ((state: RadioGroupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, RadioGroupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: RadioGroupState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-disabled | Present when the radio group is disabled. |
RadioItem
An unstyled radio item for custom radio layouts; pair with RadioControl to render the standard indicator. Renders a <span> element and a hidden <input> beside.
| Prop | Type | Default | Details |
|---|---|---|---|
value required | Value | No default | |
disabled | boolean | No default | |
required | boolean | No default | |
readOnly | boolean | No default | |
inputRef | React.Ref<HTMLInputElement> | No default | |
className | string | ((state: RadioRootState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, RadioRootState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: RadioRootState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | false | |
| Attribute | Description |
|---|---|
data-checked | Present when the radio is checked. |
data-unchecked | Present when the radio is not checked. |
data-disabled | Present when the radio is disabled. |
data-readonly | Present when the radio is readonly. |
data-required | Present when the radio is required. |
data-valid | Present when the radio is in a valid state (when wrapped in Field.Root). |
data-invalid | Present when the radio is in an invalid state (when wrapped in Field.Root). |
data-touched | Present when the radio has been touched (when wrapped in Field.Root). |
data-dirty | Present when the radio's value has changed (when wrapped in Field.Root). |
data-filled | Present when the radio is checked (when wrapped in Field.Root). |
data-focused | Present when the radio is focused (when wrapped in Field.Root). |
RadioSkeleton
Accepts the props of the element it renders.