Checkbox
@/components/kamod-ui/checkbox
By clicking this checkbox, you agree to the terms.
Installation
Import Checkbox from `@/components/kamod-ui/checkbox`.
pnpm add @kamod-ch/uiUsage
Use defaultChecked or checked with onCheckedChange. Pair with Field, FieldLabel, and data-disabled / data-invalid on Field for states. checked may be true, false, or "indeterminate" (minus icon, aria-checked=mixed).
import { Checkbox } from "@/components/kamod-ui/checkbox";<Checkbox />Demo
FieldGroup with FieldLabel, descriptions, disabled row, and nested FieldLabel (shadcn CheckboxDemo).
Usage
Minimal standalone checkbox.
Checked state
Controlled checked with onCheckedChange (boolean).
Indeterminate
Tri-state: pass checked="indeterminate" or toggle from mixed to checked via click.
Invalid
Field data-invalid and Checkbox aria-invalid (shadcn Invalid).
Basic
Single horizontal Field + FieldLabel.
Description
FieldContent with FieldDescription.
By clicking this checkbox, you agree to the terms and conditions.
Disabled
disabled on Checkbox and data-disabled on Field.
Group
FieldSet, FieldLegend, FieldGroup list (shadcn Group).
Table
Select-all and row selection with data-state on TableRow.
| Name | Role | ||
|---|---|---|---|
| Sarah Chen | sarah.chen@example.com | Admin | |
| Marcus Rodriguez | marcus.rodriguez@example.com | User | |
| Priya Patel | priya.patel@example.com | User | |
| David Kim | david.kim@example.com | Editor |
API Reference
Props, slots and variants for this component.
Checkbox
Checkbox component props and accepted values.
| Prop | Type | Default |
|---|---|---|
| checked | boolean | "indeterminate" | uncontrolled |
| defaultChecked | boolean | "indeterminate" | false |
| onCheckedChange | (checked) => void | — |
| disabled | boolean | false |
| aria-invalid | boolean | false |
| … | native input attrs | id, name, class, … |
Accessibility Notes
Prefer visible labels with htmlFor or aria-label on icon-only table checkboxes. aria-checked reflects mixed for indeterminate.