Radio group
Selects one option from a short visible list.
Workspace plan
radio-group-demo.tsx
Installation
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
npm
yarn
pnpm
bun
Composition
RadioGroupOwns the selected value. Lays out its children by orientation.
RadioGroupLabelRadioGroupDescriptionRadioGroupItemsOptionalChanges the gap between choices.
RadioFieldRepeatsRadioButtonIts text becomes the accessible name.
RadioIndicatorRadioLabel
RadioDescription
RadioGroupError
Radio Renders RadioField and its parts from children and description. Use the parts only for a custom layout.
Described options
Notifications
Every comment, change, and mention.
Only when someone mentions you.
No notifications.
radio-group-description-demo.tsx
Horizontal
Size
radio-group-horizontal-demo.tsx
Card options
Compose the RadioField parts to put content beside the label.
Plan
One project.
Unlimited projects.
Shared billing.
radio-group-card-demo.tsx
Disabled
Set isDisabled on one Radio, or on RadioGroup for all options.
Region
Not available on your plan.
radio-group-disabled-demo.tsx
Required
The error shows after the first submit. Also install Form and Button.
radio-group-required-demo.tsx
API reference
vip/ui adds or changes the props below. For all other props, see React Aria RadioGroup (opens in a new tab).
RadioGroup
- label: ReactNode
- The label of the group. Without it, pass aria-label or compose RadioGroupLabel.
- description: ReactNode
- Help text for the group, below the label.
- errorMessage: string | ((validation: ValidationResult) => string)
- Shown below the options when the group is invalid. Without it, the browser validation message shows. With label, description, or errorMessage, the group adds RadioGroupError for you.
- onValueChange: (value: string) => void
- Alias for onChange. Both run when both are set.
Radio
- children: ReactNode
- The label. Without it, pass aria-label so the option has a name.
- description: ReactNode
- Help text below the label. Linked with aria-describedby, so it is not part of the name.
- variant: "default" | "card" = "default"
- Selects the plain or card appearance. A card selects the option from anywhere inside it. RadioField takes the same prop.