Radio Group
Choose one option from a related set.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/radio-groupComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/button @siteplane/fieldset @siteplane/form @siteplane/input @siteplane/labelField is installed with Input.
Usage
import { Label } from "@/siteplane/components/label";
import { Radio, RadioGroup } from "@/siteplane/components/radio-group";
<RadioGroup aria-label="Notification frequency" defaultValue="daily">
<Label>
<Radio value="daily" />
Daily digest
</Label>
<Label>
<Radio value="weekly" />
Weekly summary
</Label>
</RadioGroup>;Composition
RadioGroup
├── Label + Radio
└── Label + RadioWith description
Give each option a FieldItem with the radio beside a column of FieldLabel and FieldDescription, and render the Field as a Fieldset whose legend names the group. Each FieldItem connects its label and description to its radio, so the description is announced separately from the name.
Controlled selection
Pass value and onValueChange to own the selected value. A disabled option cannot be selected.
Card style
Wrap each radio and its text in Label variant="card" so the whole card selects the option.
Form integration
Render the Field as a Fieldset: the legend names the group, and the form submits the selected value under the field’s name.
Sizes
Set size on the group; each radio inherits it unless it sets its own.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Radio | sm | md | lg | xl | provider / lg | Shared item size. |
value / default | unknown | uncontrolled | Controlled or initial selection. |
on | (value, eventDetails) => void | unset | Selection change callback. |
disabled | boolean | false | Disables the group. |
Radio. | sm | md | lg | xl | group / provider / lg | Per-item dimensions. |
Radio. | unknown | required | Unique option value. |
The group places its options 8 px apart. A gap-* utility in className replaces that, so a horizontal group sets its own, for example className="flex-row gap-4".
RadioProps, RadioGroupProps, RadioPrimitive and RadioGroupPrimitive are exported. radioVariants({ className }) returns the utility classes Radio adds beside its stylesheet. The look and the size come from the kit stylesheet through the attributes Radio renders; the helper does not create radio behavior.
Other props, refs, validation and events follow Base UI RadioGroup. Styled parts accept string className.
Usage notes
Tab enters the radio group; arrow keys move among enabled choices. Give both the group and each item an accessible label. Use CheckboxGroup for multiple independent values.
A selected radio fills with the brand accent, and its dot takes the text color for accent fills, --sp-rw-fg-on-accent, which a light brand sets dark (Theming).