Radio
Selects exactly one option from a small set that stays visible.
Configurations
Supported configurations for this component.
States
Interaction states covered by the API and the style contract.
Configurations
3 examplesStates
7 examplesAdd to your project
One command adds this component to your project.
Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.
npx shadcn@latest add @aicanvas/••••••••••••Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").
Props
Every prop this component accepts. Any other prop is forwarded to the underlying element.
RadioGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | - | Shared group name for the radios' native inputs; auto-generated when omitted. |
| value | string | - | Selected value in controlled mode; the matching radio is checked. |
| defaultValue | string | - | Initially selected value when uncontrolled. |
| onValueChange | (next: string) => void | - | Handler called with the newly selected value. |
| disabled | boolean | false | Disables every radio in the group. |
| children | React.ReactNode | - | Radio elements belonging to the group. |
| className | string | - | Extra classes for the group wrapper. |
| style | React.CSSProperties | - | Inline styles merged onto the group wrapper. |
Radio
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Required when used inside RadioGroup. |
| checked | boolean | - | Standalone controlled state. |
| defaultChecked | boolean | false | Initial checked state when uncontrolled and standalone. |
| onCheckedChange | (next: boolean) => void | - | Handler called with the new checked state when toggled. |
| label | string | - | Text label rendered beside the box. |
| description | React.ReactNode | - | Helper line under the label; the box aligns to the first line and the input is described by it. |
| size | 'md'|'lg' | 'md' | Two rungs, 16 and 20px boxes, scaling the box, its mark and the label together, matching Checkbox at the same value. There is no 12px `sm` rung. |
| disabled | boolean | - | Disables the radio and blocks interaction. |
| className | string | - | Extra classes merged onto the visual box. |
| style | React.CSSProperties | - | Inline styles merged onto the wrapper. |
| id | string | - | Id for the input; links the label via htmlFor, auto-generated when omitted. |
| name | string | - | Native input name that groups radios; falls back to the group's name. |