Form Radio Group

GitHub

Radio group connected to Form context with server validation errors.

Installation

bash
pnpm dlx shadcn@latest add @cs/form-radio-group

Usage

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

NameTypeDefaultDescription
descriptionstring | undefined-Supporting text displayed below the label.
groupClassNamestring | undefined-Additional classes applied to the radio group container.
itemClassNamestring | undefined-Additional classes applied to every option rendered from options.
labelstring | 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

NameTypeDefaultDescription
classNamestring | (((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.
descriptionstring | undefined-Supporting text displayed below the label.
labelstring | undefined-Label displayed next to the radio button.