Form Checkbox

GitHub

Checkbox connected to Form context with server validation errors.

Installation

bash
pnpm dlx shadcn@latest add @cs/form-checkbox

Usage

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

NameTypeDefaultDescription
checkboxClassNamestring | undefined-Additional classes applied to the checkbox control.
classNamestring | (((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.
descriptionstring | undefined-Helper text displayed below the label.
errorstring | null | undefined-Validation error message.
labelstring | 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.