Radio Group
GitHubRadio group with optional label, descriptions, inline options, and error message.
Installation
bash
pnpm dlx shadcn@latest add @cs/radio-groupUsage
tsx
import { RadioGroup } from "@/components/cs/radio-group";tsx
<RadioGroup name="plan" label="Plan" options={[{ value: "starter", label: "Starter" }, { value: "pro", label: "Pro" }]} />API Reference
RadioGroup
Radio group with optional label, descriptions, inline options, and error message.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| description | string | - | Supporting text displayed below the label. |
| error | string | null | - | Validation error message for the group. |
| groupClassName | string | - | Additional classes applied to the radio group container. |
| itemClassName | string | - | Additional classes applied to every option rendered from options. |
| label | string | - | Label displayed above the radio group. |
| name | string | - | Form field name. |
| options | { value: string; label: string; description?: string }[] | - | Radio button options. Alternatively, you can provide children. |
RadioGroupItem
A single radio option with an optional label and supporting text.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional classes applied to the option field wrapper. |
| description | string | - | Supporting text displayed below the label. |
| label | string | - | Label displayed next to the radio button. |