Core logic for the checkbox widget implemented as a state machine
npm install @zag-js/checkboxCore logic for the checkbox widget implemented as a state machine
``sh`
yarn add @zag-js/checkboxor
npm i @zag-js/checkbox
- When the checkbox is surrounded by a form, we consider the effect of form "reset" event with a trackFormResettrackFieldsetDisabled
activity in the machine.
- When the checkbox is surrounded by fieldset and the fieldset is disabled, we react to set sync the disabled state
accordingly with a activity in the machine.setChecked
- A name can be passed to the machine object during initialization, which we pass to the input, to ease use in forms.
- The API exposes a method to programmatically control the checkbox's state. We automatically dispatch aindeterminate
native event when this is done, so when used in a form, the form can detect those changes.
- The checkbox machine accepts an key, to make it indeterminate by default. The API also exposes asetIndeterminate
method, to toggle this programmatically.view
- The API exposed a variable of type "checked" | "unchecked" | "mixed" so you can render parts, based on themixed` is when the checkbox is indeterminate.
current visual state of the checkbox.
Yes please! See the contributing guidelines for details.
This project is licensed under the terms of the MIT license.