Radio Group
Single choice from a set, with arrow-key navigation and card layouts.
Shipping speed
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/radio-group.jsonUsage
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
<RadioGroup defaultValue="express" aria-label="Shipping speed">
<RadioGroupItem value="standard" label="Standard" />
<RadioGroupItem value="express" label="Express" />
</RadioGroup>Examples
Card variant
variant="card" turns each option into a tile. icon sits above the label and children render below it.
Horizontal
Disabled option
Disabled options are skipped by arrow keys.
API reference
RadioGroup
Renders a div with role="radiogroup" and accepts its attributes.
| Prop | Type | Default |
|---|---|---|
value | stringControlled selected value. | None |
defaultValue | stringInitial value when uncontrolled. | None |
onValueChange | (value: string) => voidCalled when the selection changes. | None |
name | stringShared name of the native radios. Set it to submit the value with a form. | generated |
orientation | "vertical"Stacks options or lays them out in a row. Cards stack below 640px and share the row above it. | "vertical" |
variant | "default"Classic radios, or bordered tiles with a corner indicator. | "default" |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
size | "sm"Radio, text and card padding. | "md" |
disabled | booleanDisables every option. | false |
required | booleanRequires a selection before a form can submit. | false |
RadioGroupItem
className and style go to the outer label; other native input attributes go to the radio input, which also receives the ref.
| Prop | Type | Default |
|---|---|---|
value | stringValue reported when this option is selected. Required. | None |
label | ReactNodeOption name, used as the accessible name. | None |
description | ReactNodeSecondary text, linked with aria-describedby. | None |
icon | ReactNodeCard variant only. Shown above the label and lit when selected. | None |
children | ReactNodeExtra content below the description, such as a price. Also announced as a description. | None |
disabled | booleanDisables this option only. | false |
Accessibility
- A form reset moves the selection back to where it started and calls onValueChange.
- Options are native radio inputs sharing one name, so the group is a single tab stop and arrow keys move and select.
- Give the group an accessible name with aria-label or aria-labelledby.
- Each label is wired with aria-labelledby, so descriptions and card content are read as descriptions, not as part of the name.