rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Selection — marquee multi-select + bulk actions

Marquee rubber-band multi-select for any list. Drag-right encloses, drag-left crosses, bulk delete.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
selection.prompt.mdmarkdown
# Install `selection` — Selection — marquee multi-select + bulk actions

> Marquee rubber-band multi-select for any list. Drag-right encloses, drag-left crosses, bulk delete.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/selection
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=selection
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/selection

## 1. Install

```bash
npx rahman-resources add selection
# alias: npx rr add selection
```

The CLI copies `frontend/slices/selection/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 3. Wire it up

Run `npx rr add selection`. Zero deps (react-dom only). Wrap your list area in `<SelectionProvider onBulkDelete={(ids) => removeMany(ids)}>`, give the surface a `position: relative` div with a ref, drop `<SelectionMarquee containerRef={ref} />` inside it, and wrap each item in `<SelectableBlock id={item.id} orderedIds={allIds}>…</SelectableBlock>`. Hold-drag on empty space to rubber-band: drag RIGHT = window (only fully-enclosed, solid ring), drag LEFT = crossing (anything touched, dashed green). Edge-click an item to pick it (Shift = range, Cmd/Ctrl = toggle). Backspace/Delete bulk-deletes (focus outside a contentEditable), Escape + click-outside clear, floating `N selected · Delete · Clear` toolbar. Read state anywhere via `useSelection()`. The slice owns ONLY the id set — you own the data + the delete. Works on table rows / cards too, not just notion blocks.

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.