Radio Group

GitHub

Radio group with optional label, descriptions, inline options, and error message.

Installation

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

Usage

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

NameTypeDefaultDescription
descriptionstring-Supporting text displayed below the label.
errorstring | null-Validation error message for the group.
groupClassNamestring-Additional classes applied to the radio group container.
itemClassNamestring-Additional classes applied to every option rendered from options.
labelstring-Label displayed above the radio group.
namestring-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

NameTypeDefaultDescription
classNamestring-Additional classes applied to the option field wrapper.
descriptionstring-Supporting text displayed below the label.
labelstring-Label displayed next to the radio button.