Slice · AI prompt
Generic sortable/filterable/paginated table — row selection + column visibility on shadcn Table.
# Install `data-table` — Data Table — TanStack + shadcn
> Generic sortable/filterable/paginated table — row selection + column visibility on shadcn Table.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/data-table
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=data-table
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/data-table
## 1. Install
```bash
npx rahman-resources add data-table
# alias: npx rr add data-table
```
The CLI copies `frontend/slices/data-table/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 2. What it ships
- npm: `@tanstack/react-table`
- shadcn primitives: `table`, `button`, `input`, `checkbox`, `dropdown-menu`, `badge`, `select`
## 3. Wire it up
Run `npx rr add data-table`. Build ColumnDef<TData>[] (use sortable headers via DataTableColumnHeader), pass data + columns to <DataTable>. searchKey binds the toolbar input to one column; selectable prepends the checkbox column; density tightens row padding.
## 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.