Skip to main content

Radio

A single-select group, controlled via value. Built from Radio.Root and Radio.Item (which internally composes Radio.Indicator and Radio.Label).

Basic usage

Monthly
Yearly
Lifetime
function RadioExample() {
const [value, setValue] = useState('monthly');

return (
<Radio.Root value={value} onChange={setValue}>
<Radio.Item value="monthly" label="Monthly" />
<Radio.Item value="yearly" label="Yearly" />
<Radio.Item value="lifetime" label="Lifetime" />
</Radio.Root>
);
}

Color and disabled state

color on Radio.Root sets the selected dot/border token for every item. Set isDisabled on the root to disable the whole group, or on an individual Radio.Item to disable just that item.

Enabled
Disabled item
<Radio.Root value={value} onChange={setValue} color="secondary">
<Radio.Item value="a" label="Enabled" />
<Radio.Item value="b" label="Disabled item" isDisabled />
</Radio.Root>

Props

Radio.Root Props

PropTypeDefaultDescription
valuestringRequired. The currently selected item value. Controlled.
onChange(value: string) => voidRequired. Called with the pressed item's value.
colorTVajraColors'primary'Selected dot/border color token, applied to every item's indicator.
isDisabledbooleanfalseDisables all items unless individually overridden.
childrenReactNodeRequired. Radio.Item elements.

Radio.Item Props

PropTypeDefaultDescription
valuestringRequired. Unique identifier compared against the root's value.
labelstringOptional label text rendered next to the indicator.
isDisabledbooleanOverrides the root's isDisabled for this item.

Radio.Indicator Props

PropTypeDefaultDescription
isSelectedbooleanRequired. Whether to render the filled dot.
isDisabledbooleanRequired. Dims the indicator.
colorTVajraColors'primary'Dot/border color token when selected.

Radio.Label Props

PropTypeDefaultDescription
labelstringRequired. Text to display.
isDisabledbooleanRequired. Dims the label.