# Checkbox primitive
Source: https://texuli.com/primitives-page/checkbox/
# Checkbox
A two- or three-state checkbox, alone or in a group.
Import
`import { Checkbox } from '@texuli/primitives/checkbox';`
Pattern
[Checkbox (WAI-ARIA APG)](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/)
Size budget
4.0 KiB gzip for @texuli/primitives/checkbox
Reference
`packages/primitives/docs/prim-checkbox.md`
## Live demo
Right to left
Loading the Checkbox demo…
## Anatomy
Checkbox anatomy: each box holds the parts inside it.
- `Checkbox.Group`optional`Checkbox.Root``Checkbox.Indicator`
## Behavior checks
`tests/behavior/scenarios/checkbox.spec.ts` runs **7 rows** against the Checkbox scenario on Chromium, WebKit and the Pixel 7. Each row asserts what a user or assistive technology can observe, held to the WAI-ARIA Authoring Practices pattern.
All 7 rows
- it is a checkbox named by its label and described, unchecked
- a click toggles it
- Space toggles it
- a click on its label toggles it
- partly selected is announced as mixed
- a disabled checkbox cannot change
- checked, its value is submitted with the form
### Limits
- Every row passes on every project; a flaky row gets at most two retries.
- Size: at most 4.0 KiB gzip for `@texuli/primitives/checkbox` (`pnpm size`).
- Open-to-focus: p75 at most 150 ms (asserted with `TEXULI_PERF=1`).
Checkbox
A two- or three-state checkbox, alone or in a group.
- Import
import { Checkbox } from '@texuli/primitives/checkbox';- Pattern
- Checkbox (WAI-ARIA APG)
- Size budget
- 4.0 KiB gzip for @texuli/primitives/checkbox
- Reference
packages/primitives/ docs/ prim-checkbox.md
Loading the Checkbox demo…
Anatomy
Checkbox.GroupoptionalCheckbox.RootCheckbox.Indicator
Behavior checks
tests/behavior/scenarios/checkbox.spec.ts runs 7 rows against the Checkbox scenario on Chromium, WebKit and the Pixel 7. Each row asserts what a user or assistive technology can observe, held to the WAI-ARIA Authoring Practices pattern.
All 7 rows
- it is a checkbox named by its label and described, unchecked
- a click toggles it
- Space toggles it
- a click on its label toggles it
- partly selected is announced as mixed
- a disabled checkbox cannot change
- checked, its value is submitted with the form
Limits
- Every row passes on every project; a flaky row gets at most two retries.
- Size: at most 4.0 KiB gzip for
@texuli/primitives/checkbox(pnpm size). - Open-to-focus: p75 at most 150 ms (asserted with
TEXULI_PERF=1).