Form Radio Group
GitHubRadio group connected to Form context with server validation errors.
Installation
bash
pnpm dlx shadcn@latest add @cs/form-radio-groupUsage
tsx
import { FormRadioGroup } from "@/components/cs/form-radio-group"tsx
<FormRadioGroup name="plan" />API Reference
FormRadioGroup
Radio group connected to Form context with server validation errors.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| description | string | undefined | - | Supporting text displayed below the label. |
| groupClassName | string | undefined | - | Additional classes applied to the radio group container. |
| itemClassName | string | undefined | - | Additional classes applied to every option rendered from options. |
| label | string | undefined | - | Label displayed above the radio group. |
| name * | string | - | Form field name used for submission and validation errors. |
| options | { value: string; label: string; description?: string; }[] | undefined | - | Radio button options. Alternatively, you can provide children. |
FormRadioGroupItem
Radio option that is disabled while the nearest Form is pending.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| className | string | (((state: RadioRootState) => string | undefined) & string) | undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. Additional classes applied to the option field wrapper. |
| description | string | undefined | - | Supporting text displayed below the label. |
| label | string | undefined | - | Label displayed next to the radio button. |