Checkbox

Data input

A checkbox with bind:checked, and bind:indeterminate for a partly checked group. With name it submits with a form. Inside a Field it takes its id, label, description, error and disabled state from the Field; use orientation="horizontal" to put the label beside it.

import { Checkbox } from '@limerdev/zest';
Checkbox for AI tools (llms.txt)
Use for
An on/off choice that takes effect when a form is submitted, or one of several independent options.
Don't
A setting that applies at once: use Switch. Choosing one of several options: use RadioGroup. A Checkbox without a label.

Examples

Basic

Put a Checkbox and its label in a horizontal Field; clicking the label toggles it.

With a description

Field.Content stacks the label and its description beside the checkbox.

Select all

indeterminate shows that only some of a group are checked.

Submit hours for

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Checkbox

Prop Type Default Description
checked bindable boolean false The checked state of the checkbox. It can be one of: - true for checked - false for unchecked
disabled null | false | true false Whether the checkbox is disabled.
form string undefined The id of the form to link the checkbox button and hidden input to.
indeterminate bindable boolean false Whether the checkbox is in an indeterminate state or not.
name any undefined The name of the checkbox used in form submission. If not provided, the hidden input will not be rendered.
onCheckedChange OnChangeFn<boolean> – A callback function called when the checked state changes.
onIndeterminateChange OnChangeFn<boolean> – A callback function called when the indeterminate state changes.
readonly null | false | true false Whether the checkbox is read only. If readonly, the checkbox will be focusable by the user, but will not be able to be checked/unchecked.
required boolean false Whether the checkbox is required (for form validation).
value string undefined The value of the checkbox used in form submission and to identify the checkbox when in a Checkbox.Group. If not provided while in a Checkbox.Group, the checkbox will use a random identifier.