Patterns
Sortable Data Table
A sortable project table with full-cell sort targets and an active clickable row.
Import
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/sortable-data-tableImport
import { SortableDataTable } from "@/components/patterns/sortable-data-table";Need the machine-readable source metadata? View registry JSON.
Usage
Sortable Data Table has source and usage docs, but no curated public example set yet.
import { SortableDataTable } from "@/components/patterns/sortable-data-table";Purpose
Sortable Data Table is a registry:component for sortable project data with full-cell sort targets and a keyboard-selectable active row.
API Reference
- Render
SortableDataTablefor the included project-table example. - Adapt the row type, data and typed columns after installation while keeping a stable row id.
- Sortable columns need an accessor. Row selection is controlled by
activeRowIdandonRowClick.
Motion
- The recipe adds no sorting or row-selection motion.
- The table updates immediately and respects the native focus behavior of DataTable.
Accessibility
- Sort buttons expose
aria-sortthrough DataTable. - Interactive rows are keyboard reachable and need a row-specific accessible label.
- Keep the active state textual or semantic; do not rely on background color alone.
Implementation Guidance
- Install with
pnpm dlx shadcn@4.16.1 add @siteplane/sortable-data-table. - Prefer DataTable columns and accessors over custom table sorting code.
- Adapt the installed recipe source for project row types, column labels and a row-selection callback; keep the recipe when a project row opens Detail Drawer.
- Use the lower-level DataTable for non-project data or materially different table mechanics.
Registry
Source Contract
Registry item: sortable-data-table
Files
src/components/patterns/sortable-data-table.tsxto components/patterns/sortable-data-table.tsx
Registry dependencies: @siteplane/base, @siteplane/data-table