Checkbox

Yes, no, or some of them.

Default

Ticked to start with, empty, and one that cannot be changed.

A box that is ticked, empty, or half-ticked. The third state is for a parent box standing over a list where only some are chosen: it is announced as mixed, and clicking it chooses all of them.

Installation

npx philcn@latest add checkbox

The file is written into your project. It is yours from then on — change it as you like.

Examples

Half-ticked

The parent box follows its children: all, none, or some.

Props

PropTypeWhat it does
Checkbox.checkedCheckedStateControlled. `true`, `false`, or the string `"indeterminate"` for the mixed state.
Checkbox.defaultCheckedCheckedStateUncontrolled: how it starts.
Checkbox.onCheckedChange((checked: CheckedState) => void)Called with the new state on every click.
Checkbox.namestringThe name it is submitted under in a form.
Checkbox.disabledbooleanOut of reach, and out of the tab order.

Types are read from the library itself, so this table cannot describe an option the code no longer has.