Form Checkbox
GitHubCheckbox connected to Form context with server validation errors.
Installation
bash
pnpm dlx shadcn@latest add @cs/form-checkboxUsage
tsx
import { FormCheckbox } from "@/components/cs/form-checkbox"tsx
<FormCheckbox name="terms" label="Accept terms" />API Reference
FormCheckbox
Checkbox connected to Form context that displays server validation errors.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| checkboxClassName | string | undefined | - | Additional classes applied to the checkbox control. |
| className | string | (((state: CheckboxRootState) => string | undefined) & string) | undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. Classes for the checkbox control. |
| color | "default" | "green" | "red" | "dark" | "yellow" | "orange" | null | undefined | - | Controls the checked checkbox color. |
| description | string | undefined | - | Helper text displayed below the label. |
| error | string | null | undefined | - | Validation error message. |
| label | string | undefined | - | Checkbox label. |
| name * | string | - | Form field name used for submission and validation errors. |
| orientation | "vertical" | "horizontal" | "responsive" | null | undefined | - | Layout of the checkbox control and its text. |