#118
Selectable
Two toggle chips, Filter A starting off and Filter B starting on, that flip on click.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Selectable" pattern (@codeatlasdev/ui demo #118, display/chip) in my app.
Call get_demo({ ids: ["#118"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Filter chips that toggle a facet on or off in a list or search view.
Keep these library parts, with the props and tokens the demo uses:
- Chip from "@codeatlasdev/ui"
Behaviour to keep:
- `let a = $state(false)` and `let b = $state(true)` hold the state
- `<Chip label="Filter A" selected={a} onclick={() => (a = !a)} />`
- `<Chip label="Filter B" selected={b} onclick={() => (b = !b)} />`
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
- Chip
@codeatlasdev/ui
How it is built
- `let a = $state(false)` and `let b = $state(true)` hold the state
- `<Chip label="Filter A" selected={a} onclick={() => (a = !a)} />`
- `<Chip label="Filter B" selected={b} onclick={() => (b = !b)} />`
Related
Loading source.