Skip to content

RadioGroup

A controlled radio group for single-value selection.

Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
/>
Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
orientation="horizontal"
/>
Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
size="sm"
/>
Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
size="lg"
/>
Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
isDisabled
/>
Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
isReadOnly
/>
Notification preference
function ItemDisabledStory(args: RadioGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<RadioGroup {...args} onChange={setValue} value={value}>
<RadioGroupItem label="Email" value="email" />
<RadioGroupItem isDisabled label="SMS" value="sms" />
<RadioGroupItem label="Push" value="push" />
</RadioGroup>
);
}
<ItemDisabledStory {...args} />
Notification preferenceRequired
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
isRequired
/>
Notification preferenceOptional
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
isOptional
/>
Notification preference
Best for detailed updates.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
status={{message: 'Select a notification preference.', type: 'error'}}
/>
Notification preference
Recommended
function WithEndContentStory(args: RadioGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<RadioGroup {...args} onChange={setValue} value={value}>
<RadioGroupItem
endContent={<Badge color="blue" label="Recommended" />}
label="Email"
value="email"
/>
<RadioGroupItem label="SMS" value="sms" />
<RadioGroupItem label="Push" value="push" />
</RadioGroup>
);
}
<WithEndContentStory {...args} />
Notification preference
function WithIconsStory(args: RadioGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<RadioGroup {...args} onChange={setValue} value={value}>
<RadioGroupItem
label="Email"
startContent={<Icon color="secondary" icon={Mail} size="sm" />}
value="email"
/>
<RadioGroupItem
label="SMS"
startContent={<Icon color="secondary" icon={MessageSquare} size="sm" />}
value="sms"
/>
<RadioGroupItem
label="Push"
startContent={<Icon color="secondary" icon={Bell} size="sm" />}
value="push"
/>
</RadioGroup>
);
}
<WithIconsStory {...args} />
Notification preference
Best for detailed updates.
SMS may incur carrier charges.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
status={{message: 'SMS may incur carrier charges.', type: 'warning'}}
/>
Notification preference
Best for detailed updates.
Preference saved.
<RadioGroup
label="Notification preference"
description="Choose one delivery channel."
htmlName="notificationPreference"
value="email"
status={{message: 'Preference saved.', type: 'success'}}
/>

A controlled radio group for single-value selection.

When isOptional: false, isRequired: false

PropTypeDefaultDescription
children*ReactNodeRadio list items to render.
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
htmlNamestringHTML name attribute shared by radio inputs for native form submission.
isDisabledbooleanfalseWhether all radio items are disabled.
isReadOnlybooleanfalseWhether the selected value can be changed by the user. Read-only radio items remain enabled for form submission but cannot be focused or activated.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the radio group.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: string) => voidCallback fired when the selected value changes. Memoize with useCallback to avoid unnecessary re-renders of radio items.
orientation"horizontal" | "vertical"'vertical'Layout direction of the radio items.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the radio controls.
statusInputStatusValidation status displayed below the group.
styleCSSPropertiesInline styles applied to the field root.
value*stringThe currently selected value.
isOptionalfalse
isRequiredfalse

When isOptional: true, isRequired: false

PropTypeDefaultDescription
children*ReactNodeRadio list items to render.
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
htmlNamestringHTML name attribute shared by radio inputs for native form submission.
isDisabledbooleanfalseWhether all radio items are disabled.
isReadOnlybooleanfalseWhether the selected value can be changed by the user. Read-only radio items remain enabled for form submission but cannot be focused or activated.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the radio group.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: string) => voidCallback fired when the selected value changes. Memoize with useCallback to avoid unnecessary re-renders of radio items.
orientation"horizontal" | "vertical"'vertical'Layout direction of the radio items.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the radio controls.
statusInputStatusValidation status displayed below the group.
styleCSSPropertiesInline styles applied to the field root.
value*stringThe currently selected value.
isOptional*true
isRequiredfalse

When isOptional: false, isRequired: true

PropTypeDefaultDescription
children*ReactNodeRadio list items to render.
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
htmlNamestringHTML name attribute shared by radio inputs for native form submission.
isDisabledbooleanfalseWhether all radio items are disabled.
isReadOnlybooleanfalseWhether the selected value can be changed by the user. Read-only radio items remain enabled for form submission but cannot be focused or activated.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the radio group.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: string) => voidCallback fired when the selected value changes. Memoize with useCallback to avoid unnecessary re-renders of radio items.
orientation"horizontal" | "vertical"'vertical'Layout direction of the radio items.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the radio controls.
statusInputStatusValidation status displayed below the group.
styleCSSPropertiesInline styles applied to the field root.
value*stringThe currently selected value.
isOptionalfalse
isRequired*true

An individual radio option within a `RadioGroup`.

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the item root.
data-testidstringTest ID applied to the item root.
descriptionReactNodeSupporting text displayed below the item label.
endContentReactNodeContent rendered after the label and description.
isDisabledbooleanfalseWhether this radio item is disabled.
label*stringLabel text for the radio item.
refRef<HTMLDivElement>Ref forwarded to the item root.
startContentReactNodeContent rendered after the radio control and before the label.
styleCSSPropertiesInline styles applied to the item root.
value*stringValue represented by this radio item.