#387
Shift range selection
Five checkboxes where Shift+click selects the whole range from the last clicked row, using the forwarded onclick and data-testid.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Shift range selection" pattern (@codeatlasdev/ui demo #387, inputs/checkbox) in my app.
Call get_demo({ ids: ["#387"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Lists and tables with row selection that need Shift range selection.
Keep these library parts, with the props and tokens the demo uses:
- Checkbox from "@codeatlasdev/ui"
Behaviour to keep:
- `onclick={(e) => (shift = e.shiftKey)}` is forwarded to the input and runs just before `onchange`
- `onchange={(on) => toggle(i, on)}` applies the state to every row between the anchor and the clicked row when shift was held
- `data-testid="row-{i}"` lands on the native input
- Footer line counts the selected rows
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
- `onclick={(e) => (shift = e.shiftKey)}` is forwarded to the input and runs just before `onchange`
- `onchange={(on) => toggle(i, on)}` applies the state to every row between the anchor and the clicked row when shift was held
- `data-testid="row-{i}"` lands on the native input
- Footer line counts the selected rows
Related
Loading source.