Checkbox
A control that allows the user to toggle between checked and not checked.
Installation
›pnpm dlx shadcn@latest add @evolphin/checkbox
Usage
import { Checkbox } from "@/components/ui/checkbox"<Checkbox />Type Definitions
interface CheckboxProps {
/** The controlled checked state of the checkbox */
checked?: boolean | "indeterminate"; /** The default checked state when uncontrolled */
?: boolean | "indeterminate";
/** Event handler called when the checked state changes */
?: (: boolean | "indeterminate") => void;
/** Whether the checkbox is disabled */
?: boolean;
}Examples
Default
Disabled
API Reference
Checkbox
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | "indeterminate" | - | The controlled checked state of the checkbox. |
defaultChecked | boolean | "indeterminate" | - | The default checked state when uncontrolled. |
onCheckedChange | (checked: boolean | "indeterminate") => void | - | Event handler called when the checked state changes. |
disabled | boolean | false | Whether the checkbox is disabled. |
required | boolean | false | Whether the checkbox is required. |
name | string | - | The name of the checkbox. |
value | string | "on" | The value of the checkbox. |