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 checkboxThe 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
| Prop | Type | What it does |
|---|---|---|
| Checkbox.checked | CheckedState | Controlled. `true`, `false`, or the string `"indeterminate"` for the mixed state. |
| Checkbox.defaultChecked | CheckedState | Uncontrolled: how it starts. |
| Checkbox.onCheckedChange | ((checked: CheckedState) => void) | Called with the new state on every click. |
| Checkbox.name | string | The name it is submitted under in a form. |
| Checkbox.disabled | boolean | Out 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.