DataTable
Config-driven table: one component plus a columns config that owns shape, sorting, pagination, and row interaction.
npx @slipstream-ui/cli@latest add data-tableSortable + paginated
| Status | |||
|---|---|---|---|
| MCP manifest sync | live | 42 | 2026-10-28 |
| RAG citations demo | archived | 17 | 2026-10-21 |
| Streaming edge cases | live | 96 | 2026-10-30 |
| PromptInput attachments | failed | 8 | 2026-10-12 |
1–4 of 7
Clicked row: none yet : click headers to sort, or Tab to a row and press Enter.
Empty state + no sort
| Status | |||
|---|---|---|---|
| No failed runs in this window. | |||
Custom icons · density · zebra · loading · cell callbacks
| Status | Updated | ||
|---|---|---|---|
| 42 | live | 2026-10-28 | |
| 17 | archived | 2026-10-21 | |
| 96 | live | 2026-10-30 | |
| 8 | failed | 2026-10-12 | |
| 31 | archived | 2026-10-05 | |
| 55 | live | 2026-10-29 | |
| 12 | live | 2026-10-26 |
Title cell clicked: none yet : click a Title cell (its own onClick), or sort with the custom ↑/↓/⇅ icons.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| columns | DataTableColumn<T>[] | required | Column config: key, header, optional cell renderer, sortable, align, className. |
| data | T[] | required | Row data. |
| rowId | (row: T) => string | required | Stable id per row (React key + test hooks). |
| caption | string | — | Accessible table caption. |
| defaultSort | { key: string; dir: "asc" | "desc" } | null | — | Initial sort when uncontrolled. |
| sortKey / sortDir | string | null / "asc" | "desc" | — | Controlled sort (pair with onSortChange for server-side ordering). |
| onSortChange | (key: string, dir: "asc" | "desc") => void | — | Fires when a sortable header is toggled. |
| pageSize | number | — | Rows per page; enables pagination and the result count. |
| page / onPageChange | number / (page: number) => void | — | Controlled pagination when pageSize is set. |
| onRowClick | (row: T) => void | — | Makes rows keyboard-focusable (Enter/Space) with a visible ring. |
| emptyMessage | string | 'No results.' | Shown when data is empty. |
| renderSortIcon | (state: 'none' | 'asc' | 'desc') => ReactNode | — | Replace the default ▲/▼/↕ header glyphs with custom markup. |
| stickyHeader | boolean | false | Pin the header while the body scrolls (pair with a max-height on className). |
| density | 'default' | 'compact' | 'default' | Row density: compact shrinks text and cell padding. |
| zebra | boolean | false | Zebra-striped rows for long tables. |
| loading | boolean | false | Render skeleton rows; tbody is aria-busy while loading. |
| loadingRows | number | page size (else 5) | Skeleton row count: match it to visible data so replacing placeholders does not shift the table. Row heights follow density. |
| columns[].onClick | (row: T) => void | — | Column-level callback: the cell content renders as a keyboard-operable button. |
Accessibility
- Sortable headers expose aria-sort (ascending/descending/none) and toggle via a real button.
- Native <caption> names the table; headers are th[scope=col].
- With onRowClick rows are tabIndex=0 and activate on Enter/Space: still provide an in-cell link as the primary path.
- The result count is aria-live=polite; pagination reuses Pagination (aria-current=page).
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.
- Table markup and sorting are baseline; no newer CSS is required.