Copy to clipboard
<RadioGroup name="options" defaultValue="comfortable">
<div class="flex items-center gap-3">
<RadioGroupItem value="default" id="r1" />
<Label for="r1">Default</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="comfortable" id="r2" />
<Label for="r2">Comfortable</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="compact" id="r3" />
<Label for="r3">Compact</Label>
</div>
</RadioGroup>
<RadioGroup name="options" defaultValue="comfortable">
<div class="flex items-center gap-3">
<RadioGroupItem value="default" id="r1" />
<Label for="r1">Default</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="comfortable" id="r2" />
<Label for="r2">Comfortable</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="compact" id="r3" />
<Label for="r3">Compact</Label>
</div>
</RadioGroup><RadioGroup name="options" defaultValue="comfortable">
<div class="flex items-center gap-3">
<RadioGroupItem value="default" id="r1" />
<Label for="r1">Default</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="comfortable" id="r2" />
<Label for="r2">Comfortable</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="compact" id="r3" />
<Label for="r3">Compact</Label>
</div>
</RadioGroup>
Installation
Copy to clipboard
npx @vds-testing/cli add radio
npx @vds-testing/cli add radionpx @vds-testing/cli add radio
bunx @vds-testing/cli add radio
bunx @vds-testing/cli add radiobunx @vds-testing/cli add radio
pnpm dlx @vds-testing/cli add radio
pnpm dlx @vds-testing/cli add radiopnpm dlx @vds-testing/cli add radio
yarn dlx @vds-testing/cli add radio
yarn dlx @vds-testing/cli add radioyarn dlx @vds-testing/cli add radio
Usage
import { RadioGroup, RadioGroupItem } from "@/components/vds/radio"<RadioGroup name="options" defaultValue="one">
<div class="flex items-center gap-3">
<RadioGroupItem value="one" id="option-one" />
<Label for="option-one">Option One</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="two" id="option-two" />
<Label for="option-two">Option Two</Label>
</div>
</RadioGroup>Labels use vds-paragraph-regular via the Label component. The selected indicator uses --color-brand. Focus uses focus-shape.
Examples
Horizontal
Copy to clipboard
<RadioGroup name="size" defaultValue="md" orientation="horizontal">
<div class="flex items-center gap-2">
<RadioGroupItem value="sm" id="sm" />
<Label for="sm">Small</Label>
</div>
<div class="flex items-center gap-2">
<RadioGroupItem value="md" id="md" />
<Label for="md">Medium</Label>
</div>
<div class="flex items-center gap-2">
<RadioGroupItem value="lg" id="lg" />
<Label for="lg">Large</Label>
</div>
</RadioGroup>
<RadioGroup name="size" defaultValue="md" orientation="horizontal">
<div class="flex items-center gap-2">
<RadioGroupItem value="sm" id="sm" />
<Label for="sm">Small</Label>
</div>
<div class="flex items-center gap-2">
<RadioGroupItem value="md" id="md" />
<Label for="md">Medium</Label>
</div>
<div class="flex items-center gap-2">
<RadioGroupItem value="lg" id="lg" />
<Label for="lg">Large</Label>
</div>
</RadioGroup><RadioGroup name="size" defaultValue="md" orientation="horizontal">
<div class="flex items-center gap-2">
<RadioGroupItem value="sm" id="sm" />
<Label for="sm">Small</Label>
</div>
<div class="flex items-center gap-2">
<RadioGroupItem value="md" id="md" />
<Label for="md">Medium</Label>
</div>
<div class="flex items-center gap-2">
<RadioGroupItem value="lg" id="lg" />
<Label for="lg">Large</Label>
</div>
</RadioGroup>
With description
Copy to clipboard
Default spacing for most users.
Reduced spacing for power users.
<RadioGroup name="plan" defaultValue="comfortable" class="gap-4">
<div class="flex items-start gap-3">
<RadioGroupItem value="comfortable" id="comfortable" class="mt-1" />
<div class="grid gap-1">
<Label for="comfortable">Comfortable</Label>
<p class="vds-paragraph-s text-muted-foreground">Default spacing for most users.</p>
</div>
</div>
<div class="flex items-start gap-3">
<RadioGroupItem value="compact" id="compact" class="mt-1" />
<div class="grid gap-1">
<Label for="compact">Compact</Label>
<p class="vds-paragraph-s text-muted-foreground">Reduced spacing for power users.</p>
</div>
</div>
</RadioGroup>
<RadioGroup name="plan" defaultValue="comfortable" class="gap-4">
<div class="flex items-start gap-3">
<RadioGroupItem value="comfortable" id="comfortable" class="mt-1" />
<div class="grid gap-1">
<Label for="comfortable">Comfortable</Label>
<p class="vds-paragraph-s text-muted-foreground">Default spacing for most users.</p>
</div>
</div>
<div class="flex items-start gap-3">
<RadioGroupItem value="compact" id="compact" class="mt-1" />
<div class="grid gap-1">
<Label for="compact">Compact</Label>
<p class="vds-paragraph-s text-muted-foreground">Reduced spacing for power users.</p>
</div>
</div>
</RadioGroup><RadioGroup name="plan" defaultValue="comfortable" class="gap-4">
<div class="flex items-start gap-3">
<RadioGroupItem value="comfortable" id="comfortable" class="mt-1" />
<div class="grid gap-1">
<Label for="comfortable">Comfortable</Label>
<p class="vds-paragraph-s text-muted-foreground">Default spacing for most users.</p>
</div>
</div>
<div class="flex items-start gap-3">
<RadioGroupItem value="compact" id="compact" class="mt-1" />
<div class="grid gap-1">
<Label for="compact">Compact</Label>
<p class="vds-paragraph-s text-muted-foreground">Reduced spacing for power users.</p>
</div>
</div>
</RadioGroup>
Disabled
Non-clickable radios use the disabled state. The control and indicator switch to --color-muted-foreground (dark gray).
Copy to clipboard
<RadioGroup name="disabled-group" disabled defaultValue="one">
<div class="flex items-center gap-3">
<RadioGroupItem value="one" id="d1" />
<Label for="d1" class="text-muted-foreground">Option One</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="two" id="d2" />
<Label for="d2" class="text-muted-foreground">Option Two</Label>
</div>
</RadioGroup>
<RadioGroup name="disabled-group" disabled defaultValue="one">
<div class="flex items-center gap-3">
<RadioGroupItem value="one" id="d1" />
<Label for="d1" class="text-muted-foreground">Option One</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="two" id="d2" />
<Label for="d2" class="text-muted-foreground">Option Two</Label>
</div>
</RadioGroup><RadioGroup name="disabled-group" disabled defaultValue="one">
<div class="flex items-center gap-3">
<RadioGroupItem value="one" id="d1" />
<Label for="d1" class="text-muted-foreground">Option One</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="two" id="d2" />
<Label for="d2" class="text-muted-foreground">Option Two</Label>
</div>
</RadioGroup>
Single item disabled
Copy to clipboard
<RadioGroup name="mixed" defaultValue="enabled">
<div class="flex items-center gap-3">
<RadioGroupItem value="enabled" id="m1" />
<Label for="m1">Available</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="locked" id="m2" disabled checked />
<Label for="m2" class="text-muted-foreground">Unavailable</Label>
</div>
</RadioGroup>
<RadioGroup name="mixed" defaultValue="enabled">
<div class="flex items-center gap-3">
<RadioGroupItem value="enabled" id="m1" />
<Label for="m1">Available</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="locked" id="m2" disabled checked />
<Label for="m2" class="text-muted-foreground">Unavailable</Label>
</div>
</RadioGroup><RadioGroup name="mixed" defaultValue="enabled">
<div class="flex items-center gap-3">
<RadioGroupItem value="enabled" id="m1" />
<Label for="m1">Available</Label>
</div>
<div class="flex items-center gap-3">
<RadioGroupItem value="locked" id="m2" disabled checked />
<Label for="m2" class="text-muted-foreground">Unavailable</Label>
</div>
</RadioGroup>
Standalone Radio
Copy to clipboard
<div class="flex flex-col gap-2">
<div class="flex items-center gap-2">
<Radio id="option-one" name="standalone" value="one" />
<Label for="option-one">Option One</Label>
</div>
<div class="flex items-center gap-2">
<Radio id="option-two" name="standalone" value="two" />
<Label for="option-two">Option Two</Label>
</div>
</div>
<div class="flex flex-col gap-2">
<div class="flex items-center gap-2">
<Radio id="option-one" name="standalone" value="one" />
<Label for="option-one">Option One</Label>
</div>
<div class="flex items-center gap-2">
<Radio id="option-two" name="standalone" value="two" />
<Label for="option-two">Option Two</Label>
</div>
</div><div class="flex flex-col gap-2">
<div class="flex items-center gap-2">
<Radio id="option-one" name="standalone" value="one" />
<Label for="option-one">Option One</Label>
</div>
<div class="flex items-center gap-2">
<Radio id="option-two" name="standalone" value="two" />
<Label for="option-two">Option Two</Label>
</div>
</div>
Anatomy
RadioGroup- Container that manages the radio group stateRadioGroupItem- Individual radio button within a groupRadio- Standalone radio input for simple use casesLabel- Option text usingvds-paragraph-regular
Props
RadioGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | - | Required. Groups radio buttons together |
| defaultValue | string | - | Initially selected value |
| disabled | boolean | false | Makes all items non-clickable with dark gray styling |
| required | boolean | false | Makes selection required |
| orientation | “horizontal” | “vertical” | “vertical” | Layout direction |
| class | string | - | Additional CSS classes |
RadioGroupItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Required. Form value when selected |
| id | string | - | Element ID for label association |
| disabled | boolean | false | Non-clickable; uses --color-muted-foreground |
| checked | boolean | false | Controlled checked state |
| class | string | - | Additional CSS classes |
Radio
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | - | Element ID for label association |
| name | string | - | Groups radio buttons together |
| value | string | - | Form value when selected |
| checked | boolean | false | Default checked state |
| disabled | boolean | false | Non-clickable; uses --color-muted-foreground |
| required | boolean | false | Makes selection required |
| class | string | - | Additional CSS classes |
Focus
Radios use focus-shape (yellow/black double ring) on keyboard focus.