Checkbox
An independent on/off, with a third indeterminate state.
import { Checkbox } from '@textui/core';
<Checkbox label="Notify on failure" checked onChange={(checked) => console.log(checked)} />
Props
| Prop | Type | Default | |
| — | — | — | — |
| label | string | | |
| checked | boolean | false | |
| indeterminate | boolean | | Neither checked nor unchecked - a parent of mixed children. |
| onChange | (checked: boolean) => void | | |
Plus everything on BoxProps.
Role: checkbox.
Space toggles it. indeterminate is the “some of the children” state for a
parent checkbox; it is a display state only, and the next toggle resolves to
checked.
Use a checkbox when the options are independent. When exactly one of several
must be chosen, that is a RadioGroup, and when the thing
takes effect immediately rather than on submit it reads better as a
Switch.
See also
- Switch - the same boolean, different promise
- RadioGroup - one of several
- Field - wrapping it in a form