Radio Group
A set of radio buttons that allows users to select only one option from a predefined list. It provides clear visual feedback and supports keyboard navigation.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/radio
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
npm install react-aria-components tailwind-merge
Anatomy
import { Description, Label } from "@/components/ui/field"
import { Radio, RadioGroup, RadioLabel } from "@/components/ui/radio"<RadioGroup name="billing">
<Label>Billing Cycle</Label>
<Description>
Select how often you'd like to be billed
</Description>
<Radio value="monthly">
<RadioLabel>Monthly</RadioLabel>
<Description>Billed every month</Description>
</Radio>
<Radio value="quarterly">
<RadioLabel>Quarterly</RadioLabel>
<Description>Billed every 3 months</Description>
</Radio>
<Radio value="yearly">
<RadioLabel>Yearly</RadioLabel>
<Description>
Billed once per year with a discount
</Description>
</Radio>
</RadioGroup>Examples
Orientation
By default, the radio group is vertically oriented. You can change it to a horizontal orientation by using the orientation prop.
Without label
The label is optional. You can omit it if not needed.
Description
Add a description to the radio group by passing the description prop.
Validation
Try submit the form without selecting any radio option to see the validation error.
Controlled
You can control the radio group value using the value prop.
Uncontrolled
You can control the radio group value using the defaultValue prop.
Disabled
When the radio group is disabled, it cannot be interacted with.
Component API
Radio
The Radio component represents one radio option.
| Prop | Type | Default |
|---|---|---|
className | string | - |
RadioGroup
The RadioGroup component groups mutually exclusive radio options.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.