DataTable: the table of every list
DataTable is the table behind every list in an app built on Meadowstack: each column says what it holds, and that kind sets its width, its alignment and its figures, so money lines up on the right on every screen. On a phone the table keeps its main columns and folds the rest under them, so it never scrolls sideways.
By Bohuslav PoláčekChecked
What it is for, and what the preview shows
DataTable is the table of a list of records: orders, invoices, dies, members. It sorts, groups, sums a column in a footer, selects rows for a BulkBar, marks the row whose record is open beside the list in a RecordPeek, and draws an empty list and a filter with no results as two different states.
The preview is the invoice list of Kestrel, an accounting practice in the demo, in its To be paid view: twelve invoices, the client as the title column, the number, two dates, the amount and the status. Four are overdue, and the row says by how many days in the danger colour, beside the word, never as colour alone.
The rules, and where each one lives
- Every column says what it holds.
meta: { kind }takes one of twelve kinds, and the kind sets the width, the alignment and the figures:moneyis 8rem wide from 768px, right-aligned, with tabular figures;dateis 7rem;idis 8rem with plain figures, because tabular figures widen the hyphens of INV-2026-0049. The widths are the kit'scolumnKinds;npm run check:columnsfails a column without a kind, and the runtime audit'scolumn-kindsrule checks alignment by kind and one width per kind on a screen (docs/audit.md). - A table never scrolls sideways on a phone. A column with
hideOnMobilehides, andCellStackfolds its value into a cell that stays. The rootAGENTS.mdsets it under Responsive; the audit'stable-scrollandhorizontal-overflowrules fail a screen that breaks it at 390px. - The table folds by its own width.
hideOnMobileis a container query on the table, so the same list folds beside a side panel at 1440px as it does on a phone. - One look, one height. A subtle header band, hairlines between rows, the hovered row a rounded chip, no outer box; rows are one height, and ticking a row never changes it (
AGENTS.md, Tables; the audit'srow-heights). - Selection keeps its slot. Every row keeps its checkbox slot, each box is 24 by 24px with its label (the audit's
target-size), and bulk actions say how many rows they apply to. - Apps import the kit, not the engine. ESLint stops an app from importing
@tanstack/react-table, andnpm run check:markupstops an own<table>(bare-table).
What AI coding tools write instead
Asked for an invoice list, a coding assistant writes what the manifest's replaces names: a hand-written <table>, a grid of divs, or TanStack Table imported straight into the page, wrapped in an overflow-x-auto box.
Each of these works on its own screen and drifts across the app: every list picks its own widths, so amounts stop lining up between screens; dates and IDs get whichever figures the font gives them; the phone gets a table to swipe sideways with the client's name scrolled out of view. Selection, the empty list and the filter with no results are rebuilt each time, and usually only one of the two empty states exists. With DataTable the assistant writes columns and kinds, and the checks above catch a column that forgets its kind.
How to use it
The props that matter, from its exported DataTableProps:
columns,data,getRowId, andlabel: the table's accessible name ("Invoices").metaon each column:kind, thenhideOnMobile(hidden under 42rem of table width) orhideBelow("sm","lg","xl": 32, 64 or 72rem) for what hides first,totalfor a sum in the footer,groupfor grouping,clipandfillfor a long name that ends in an ellipsis.CellStackin a cell:primary,secondary,secondaryOnMobileto show the folded value only when the column beside it hides, andalign="end"under money.enableSelectionwithcanSelectRowandgetRowSelectBlockedReason(the reason shows on the disabled box),getRowLabelso a screen reader hears which row a box selects.onRowClickandactiveRowIdfor a list that opens records beside it.pageSize(10 unless set),initialSorting,emptyState,isFilteredwithonClearFilters, andvariant("plain"or"card").
Load the rows with useResource and render the table inside AsyncState, which draws the loading and error states around it.
Its entry in the manifest
| Manifest field | DataTable |
|---|---|
| What it is | The table of a list: column kinds set widths, sorting, grouping, selection with BulkBar, empty and no-results states, folding on a phone. |
| Use it for | Every list of records. |
| Not for | For two or three facts (PropertyList); For a board (Board, SortableBoard) |
| It replaces | A hand-written <table>; A div grid of rows; TanStack Table imported in the app; A table that scrolls sideways on a phone |
| Screen types | Index; Worklist; Record; Overview |
| Import | import { DataTable, CellStack, tableRowClass, tableRowHoverClass, columnKinds } from "@meadowstack-studio/kit"; |
Where it runs in the example apps
| Example app | Modules that render it |
|---|---|
| An app for a packaging and print company | Jobs, Print file editor, Quotes, Cutting dies, Colour |
| An app for a studio or agency | Capacity, Finance |
| An app for a haulage company | Freight, Drivers, Costs |
| An app for a roastery with an online shop | Roasting, Green coffee, Shop, Wholesale |
| An app for a sports club | Club, Coaching, Rentals |
| An app for a construction company | Sites, Crews, Machines, Site diary, Drawings, Budget |
| An app for an accounting office | Documents, Bookkeeping, Official mail, Invoicing |
| An app for restaurants and venues | Kitchen, Food safety |
| An app for one person | Brand deals, Money, Training |
How the starter declares its columns
id: "neededBy",
accessorKey: "neededBy",
header: "Needed by",
meta: { kind: "date", hideOnMobile: true },
cell: ({ getValue }) => (
<span className="whitespace-nowrap text-fg-muted tabular">{formatDate(getValue<string>())}</span>
),
},
{
id: "status",
accessorKey: "status",
header: "Status",
meta: { kind: "status", hideOnMobile: true },
cell: ({ row }) => <RequestStatusLabel status={row.original.status} />,
sortingFn: (a, b) => statusOrder.indexOf(a.original.status) - statusOrder.indexOf(b.original.status),
},
{
id: "amount",
accessorKey: "amount",
header: "Amount",
meta: { kind: "money" },
// On a phone the status sits under the amount.
cell: ({ row }) => (
<CellStack
align="end"
primary={<span className="font-medium whitespace-nowrap">{formatMoney(row.original.amount)}</span>}
secondary={<RequestStatusLabel status={row.original.status} short />}
secondaryOnMobile
/>
),
},
],Questions
Does the table scroll sideways on a phone?
No. Columns marked to hide on a phone disappear below 672px of table width, and CellStack shows their values under the cells that stay, so the client, the number and the days overdue still read in one column.
How do I show money in a column?
Give the column the money kind. It takes a fixed width, aligns right and uses tabular figures, so amounts line up in every row and on every screen; on a phone the status can sit under the amount in the same cell.
Why does the table fold by its own width and not by the window?
Because a list is not always the whole window. When a record opens in a side panel beside it, the list gets narrower and hides its less important columns, the same way a phone does.
Can I import TanStack Table directly?
Not in an app built on the kit: ESLint stops the import. DataTable takes TanStack Table's column definitions, so the API is familiar, and adds the kinds, the fold, selection and the two empty states.
What happens when a filter hides every row?
The table says there are no results for this filter and offers to clear it. A list that is empty because nothing exists yet shows its own empty state with the action that creates the first record.
Related
- BulkBar: what to do with the selectionComponents
- FilterBar: the one row above a listComponents
- Data tables in business apps: kinds, figures, headers, cut textBlog
- A packaging quote that works out its price as you typeScreens
- A weekly timesheet for an agencyScreens
- An invoice form that shows its totals as you typeScreens
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app