AdvancedAppTable

A data table that also knows how to stop being a table. The same column config renders as pinned-header rows or as a grid of record cards, at two densities — and both switches are app-wide, so flipping one table takes every list with it.

Install: pnpm add-component AdvancedAppTable

Live table

A real table with twelve records. Open the Columns menu to switch it to record cards or compact density — those two are app-wide and persist, so the change follows you to any other table. Hide a column and it stays hidden for this table only. Shift-click checkboxes to take a range, then use the bulk bar.

Column types

Five built-in cell renderers cover most of a list page without a slot. `identity` is avatar + name + secondary lines; `badge` colours a categorised value; `chip` carries one of eight hues. Known values come from a `tones` map, and anything unmapped falls back to a stable hash — so a free-form category keeps the same colour on every page and across sessions.

Server-driven list

The shape every list page follows. `serverSide` hands search, sort and paging back to you; `total` is the row count behind the filters, which the pager and the count both read. `search` arrives debounced, so it goes straight to the API — and `refreshing` is the background refetch, which keeps the rows you are already reading on screen.

Custom cells and toolbars

A `cell-{key}` slot replaces one column outright and still gets the row, the resolved value and the index. The module exports `hueFor`, `tone` and `autoTone`, so your own cell can colour itself from the same palette the built-in ones use. `toolbar-start` / `toolbar-end` sit beside the search box.

App-wide display state

Layout and density are module-level refs, persisted in localStorage and mirrored onto <html> as data-vt-table-view and data-vt-table-density — so your own CSS can react to the same switch, and no page has to know which mode it is drawing in. The default is stored as absent, so clearing a preference is one removal rather than a written-out default.

API