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/ui

Usage

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).

Unchecked

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).

Show these items on the desktop:

Select the items you want to show on the desktop.

Table

Select-all and row selection with data-state on TableRow.

NameEmailRole
Sarah Chensarah.chen@example.comAdmin
Marcus Rodriguezmarcus.rodriguez@example.comUser
Priya Patelpriya.patel@example.comUser
David Kimdavid.kim@example.comEditor

API Reference

Props, slots and variants for this component.

Checkbox

Checkbox component props and accepted values.

PropTypeDefault
checkedboolean | "indeterminate"uncontrolled
defaultCheckedboolean | "indeterminate"false
onCheckedChange(checked) => void
disabledbooleanfalse
aria-invalidbooleanfalse
native input attrsid, name, class, …

Accessibility Notes

Prefer visible labels with htmlFor or aria-label on icon-only table checkboxes. aria-checked reflects mixed for indeterminate.