#008
States
Checkboxes in unchecked, pre-checked and indeterminate states, the first two bound to local state.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "States" pattern (@codeatlasdev/ui demo #008, inputs/checkbox) in my app.
Call get_demo({ ids: ["#008"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Boolean options in a form, such as terms acceptance or feature toggles, including a mixed state for partial selection.
Keep these library parts, with the props and tokens the demo uses:
- Checkbox from "@codeatlasdev/ui"
Behaviour to keep:
- `bind:checked={basic}` with `let basic = $state(false)` and `label="Unchecked (click me)"`
- `bind:checked` bound to `let checked = $state(true)` with `label="Pre-checked"`
- `indeterminate` with `label="Indeterminate"`
- Three `<Checkbox` components imported from `@codeatlasdev/ui`
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- Checkbox
@codeatlasdev/ui
How it is built
- `bind:checked={basic}` with `let basic = $state(false)` and `label="Unchecked (click me)"`
- `bind:checked` bound to `let checked = $state(true)` with `label="Pre-checked"`
- `indeterminate` with `label="Indeterminate"`
- Three `<Checkbox` components imported from `@codeatlasdev/ui`
Related
Loading source.