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
id(string): Required. A unique, stable id. It keys the persisted hidden-column list, so two tables sharing an id share their column preferences.columns(AdvancedTableColumn[]): Required. Each column needs a key and a label. Optional: sortable, sortField, hideable, defaultHidden, align, width, mono, nowrap, truncate, type, value, format, tones, hue, identity, copy, title, noExport. The label is user-visible three times — header, display menu, and the field label in card mode.rows(any[]): The current page's rows in serverSide mode, or every row in client mode, where the component searches, sorts and pages them itself.rowKey(string | (row) => string | number): Dot paths allowed. This is the selection identity — when it does not resolve, a row falls back to its index and a selection stops surviving a page change.loading / refreshing(boolean): loading is the first load and shows skeleton rows. refreshing is a background refetch (isFetching && !isLoading) and shows a sweep along the top edge, so stale rows stay readable instead of flashing away.serverSide(boolean): Search, sort and paging happen upstream and rows renders as given. Pair it with total — the pager, the range and the count all read that, and without it they describe the page instead of the result set.search(string): v-model:search. The input stays live but the value is emitted debounced (searchDebounce, 300ms), so what you forward to an API is never the half-typed string.sort(string): v-model:sort — a single URL-friendly token: 'field', 'field:desc', or ''. Clicking a sortable header cycles asc → desc → unsorted.paginated / page / limit(boolean / number / number): v-model:page is 1-based, v-model:limit picks from pageSizes ([25, 50, 100]). The pager is docked to the bottom by default; stickyPagination turns that off. Any filter, search or sort change resets to page 1.selectable / selected(boolean / (string | number)[]): v-model:selected. Shift-click a checkbox to select a range. The selection survives page changes so it can accumulate across them — call clearSelection() once a bulk action lands.actions(TableRowAction[]): Buttons in the last column, which is a pinned action rail: opaque, with a seam shadow, so a wide table scrolls under it. They stay at 55% opacity until the row is hovered or focused.plainLastColumn(boolean): Opts the last column out of that rail. Set it when your last column is real data rather than controls.bulkActions(TableBulkAction[]): Buttons in the bulk bar — a pill that appears once rows are selected and stacks directly above the docked pager rather than over it.exportable / exportRows(boolean / () => Promise<any[]>): CSV of the visible columns, named {exportFileName}-YYYY-MM-DD.csv and written UTF-8 with a byte-order mark so Excel reads accents back correctly. Pass exportRows to fetch every matching row instead of exporting only the page you can see.view / density(TableView / TableDensity): Pins this one table to 'table' | 'cards' and 'relaxed' | 'compact', and hides those rows from its menu. Leave them off and the table follows the app-wide preference from useTableDisplay.rowClickable(boolean): Emits rowClick. A click that landed on a link, button, input or label is not a row click, and neither is one that ends a text selection — so the controls inside a row keep working.showDisplayMenu / showCount / maxHeight(boolean / boolean / string): The Columns control, the audience count in the toolbar (the filtered total, not the page), and the height of the scroll box. maxHeight is ignored in card view, where records reflow to the page instead of scrolling in a capped box.