DataTable
organismsA typed, generic table: column accessors and cell snippets, sorting, row tones and hover actions, loading and empty states, and a card layout once its own box gets narrow.
Service fleet
cellSnippets for the status badge, rowTone accent bars, hover rowActions, onrowclick, and layout="fixed" with truncate and hideBelow.
| Service | Role | Region | CPU | Status | Actions |
|---|---|---|---|---|---|
| api-gateway | gateway | eu-west-1 | 23% | ok | |
| worker-02 | worker | eu-west-1 | 87% | warn | |
| cache-01 | cache | us-east-1 | 4% | danger | |
| postgres-primary | database | eu-west-1 | 38% | ok | |
| media-transcode | service | ap-northeast-1 | 64% | ok | |
| search-index | service | us-east-1 | 55% | warn |
Density and chrome
size="md" | "sm", headerSnippets replaces a column header (a unit badge), hideHeader keeps the header for assistive tech only, stickyHeader inside a bounded height.
| Service | Region | Memory RSS |
|---|---|---|
| api-gateway | eu-west-1 | 412 MB |
| worker-02 | eu-west-1 | 1.9 GB |
| cache-01 | us-east-1 | 7.7 GB |
| Service | Region | Memory |
|---|---|---|
| api-gateway | eu-west-1 | 412 MB |
| worker-02 | eu-west-1 | 1.9 GB |
| cache-01 | us-east-1 | 7.7 GB |
| Service | Region | Memory |
|---|---|---|
| api-gateway | eu-west-1 | 412 MB |
| worker-02 | eu-west-1 | 1.9 GB |
| cache-01 | us-east-1 | 7.7 GB |
| Service | Region | Memory |
|---|---|---|
| api-gateway | eu-west-1 | 412 MB |
| worker-02 | eu-west-1 | 1.9 GB |
| cache-01 | us-east-1 | 7.7 GB |
| postgres-primary | eu-west-1 | 15.4 GB |
| media-transcode | ap-northeast-1 | 2.2 GB |
| search-index | us-east-1 | 3.2 GB |
States
loading with no rows renders loadingRows skeleton rows at the height of data rows; loading over existing rows trails one; empty as a string or a snippet, onloadmore footer, and a long unbroken name in a fixed layout.
| Service | Region |
|---|---|
| Service | Region |
|---|---|
| api-gateway | eu-west-1 |
| worker-02 | eu-west-1 |
| cache-01 | us-east-1 |
| postgres-primary | eu-west-1 |
| Service | Region |
|---|---|
| Service | Region |
|---|---|
| api-gateway | eu-west-1 |
| worker-02 | eu-west-1 |
| cache-01 | us-east-1 |
| postgres-primary | eu-west-1 |
| Service | Region |
|---|---|
| api-gateway | eu-west-1 |
| worker-02 | eu-west-1 |
| Service | Region |
|---|---|
| No services deployed yet. | |
| Service | Region |
|---|---|
No services match Clear the region filter to see all six. | |
| Service | Region |
|---|---|
| api-gateway | eu-west-1 |
| worker-02 | eu-west-1 |
| Service | Region |
|---|---|
| eu-west-1-analytics-warehouse-rebuild-overnight-batch-worker-pool-07 | eu-west-1 |
| worker-02 | eu-west-1 |
Sorting
sortable columns sort by the displayed value; pass onsort to own the order (server-side) and the table only shows the indicator.
| api-gateway | 23 | 41 |
| worker-02 | 87 | 3 |
| cache-01 | 4 | 0 |
| postgres-primary | 38 | 120 |
| media-transcode | 64 | 12 |
| search-index | 55 | 7 |
| api-gateway | 23 | 41 |
| worker-02 | 87 | 3 |
| cache-01 | 4 | 0 |
| postgres-primary | 38 | 120 |
| media-transcode | 64 | 12 |
| search-index | 55 | 7 |
Selection mode
selectable with bind:selected and bind:selecting: checkboxes and the floating selection bar exist only while selecting; a row click toggles the row, Escape or Done leaves. The row menu gains a trailing Select item.
| Service | Region | Actions |
|---|---|---|
| api-gateway | eu-west-1 | |
| worker-02 | eu-west-1 | |
| cache-01 | us-east-1 | |
| postgres-primary | eu-west-1 | |
| media-transcode | ap-northeast-1 | |
| search-index | us-east-1 |
Responsive cards
responsive="stack" turns rows into cards under stackBelow (30rem of its own width); Column.role places title, meta, detail and hidden cells. Drag the handle.
| Service | Status | Region | CPU | Memory | Id | Actions |
|---|---|---|---|---|---|---|
| api-gateway | ok | eu-west-1 | 23% | 412 MB | 1 | |
| worker-02 | warn | eu-west-1 | 87% | 1.9 GB | 2 | |
| cache-01 | danger | us-east-1 | 4% | 7.7 GB | 3 | |
| postgres-primary | ok | eu-west-1 | 38% | 15.4 GB | 4 |
Stacked card details
Always stacked in a 22rem box: stackLabel: false joins metas on one · line and skips empty cells; stackActions="end" closes each card with its actions.
| Service | Role | Region | Id | Actions |
|---|---|---|---|---|
| api-gateway-with-a-long-unbroken-name-for-the-eu-edge | gateway | #1 | ||
| worker-02 | worker | eu-west-1 | #2 | |
| postgres-primary | database | eu-west-1 | #4 |
Row tone × size matrix
Regression fixture: every rowTone at both sizes, with alignments and a nowrap column.
| Left | Center | Right |
|---|---|---|
| rowTone="neutral" | neutral | 128 |
| rowTone="ok" | ok | 256 |
| rowTone="warn" | warn | 384 |
| rowTone="danger" | danger | 512 |
| rowTone="info" | info | 640 |
| Left | Center | Right |
|---|---|---|
| rowTone="neutral" | neutral | 128 |
| rowTone="ok" | ok | 256 |
| rowTone="warn" | warn | 384 |
| rowTone="danger" | danger | 512 |
| rowTone="info" | info | 640 |
Row actions
actions returns the row actions as data: the first inlineActions (default 1) are icon buttons, the rest sit in the "more" menu. Touch and stacked cards keep one inline whatever inlineActions says.
| Service | Role | Region | Actions |
|---|---|---|---|
| api-gateway | gateway | eu-west-1 | |
| worker-02 | worker | eu-west-1 | |
| cache-01 | cache | us-east-1 | |
| postgres-primary | database | eu-west-1 |
| Service | Role | Region | Actions |
|---|---|---|---|
| api-gateway | gateway | eu-west-1 | |
| worker-02 | worker | eu-west-1 | |
| cache-01 | cache | us-east-1 | |
| postgres-primary | database | eu-west-1 |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
columns required | Column<T>[] | — | |
rows required | T[] | — | |
rowKey required | (row: T) => string | number | — | Stable key for each row (for keyed iteration). |
onrowclick | (row: T) => void | — | |
onsort | (key: string, dir: 'asc' | 'desc') => void | — | Supply to take over ordering (server-side / custom sort). When set, the table only reflects the indicator and emits; it does not reorder rows. |
cellSnippets | Record<string, Snippet<[T]>> | {} | |
headerSnippets | Record<string, Snippet<[Column<T>]>> | {} | Replaces a column's header content (e.g. a select-all checkbox). |
empty | string | Snippet | 'No data.' | |
stickyHeader | boolean | false | Sticks within the table's own scroller, which also scrolls horizontally, so it only sticks when the table has a bounded height (e.g. `style="max-height: 60vh"`), not to the page. |
stickyOffset | string | — | Distance from the scroller's top for the sticky header. Defaults to 0. |
layout | 'auto' | 'fixed' | 'auto' | `fixed` makes declared column widths authoritative (needed for truncate). |
hideHeader | boolean | false | Visually hides the header; it stays in the DOM for assistive tech. |
size | 'sm' | 'md' | 'md' | |
rowTone | (row: T) => RowTone | undefined | — | Per-row semantic tone, rendered as a left accent bar + `data-tone`. |
rowClass | (row: T) => string | undefined | — | |
rowActions | Snippet<[T]> | — | Trailing actions cell revealed on hover/focus (always visible on touch). |
rowActionsLabel | string | 'Actions' | |
actions | (row: T) => RowAction[] | — | Data-driven row actions: the first `inlineActions` render as icon buttons, the rest in a "more" menu. Rendered after `rowActions` when both are set. |
inlineActions | number | 1 | Inline action count (default 1). Coarse pointers and stacked cards cap it at 1. |
moreLabel | string | 'More actions' | Accessible name of the "more" menu trigger; the row's name is appended. |
selectable | boolean | false | Enables selection mode. With `actions`, each row menu gains a trailing "Select" item that enters it with that row selected. |
selected bindable | (string | number)[] | [] | Bindable row keys (`rowKey`) of the selected rows. Cleared on leaving selection mode. |
selecting bindable | boolean | false | Bindable. While true the checkbox column and the selection bar show, a row click toggles the row instead of `onrowclick`, and Escape leaves. |
selectionActions | Snippet<[T[]]> | — | Bulk actions in the selection bar; receives the selected rows. |
selectionLabel | (count: number) => string | (n) => `${n} selected` | |
selectLabel | string | 'Select' | Label of the row menu item that enters selection mode. |
selectRowLabel | (row: T) => string | — | Accessible name of a row's checkbox. Defaults to `Select <title or first column value>`. |
selectAllLabel | string | 'Select all' | |
selectionBarLabel | string | 'Selection' | Accessible name of the selection bar. |
doneLabel | string | 'Done' | |
loading | boolean | false | With no rows: `loadingRows` skeleton rows at the height of a data row. With rows: the rows stay and one skeleton row trails them. |
loadingLabel | string | 'Loading…' | Announced to assistive tech while loading (visually hidden). |
loadingRows | number | 5 | |
onloadmore | () => void | — | Renders a footer "load more" button that calls this. |
loadMoreLabel | string | 'Load more' | |
responsive | 'scroll' | 'stack' | 'scroll' | `stack` renders each row as a card once the table's own box is narrower than `stackBelow`; `scroll` (default) keeps a horizontal scroller. |
stackBelow | string | '48rem' | Width (px/em/rem) under which `stack` mode kicks in. |
stackActions | 'start' | 'end' | 'start' | Where actions sit in a stacked card: `start` beside the title (wraps under a long one), `end` always closing the card. |
class | string | '' | |
style | string | '' | |
tableClass | string | '' | Class on the inner <table>. |