Skip to content

Blog

Data tables in business apps: kinds, figures, headers, cut text

By Bohuslav PoláčekPublished

The twelve column kinds of the kit's DataTable (columnKinds in packages/kit/src/components/data-table.tsx), with what the runtime audit checks on each.

What the review found

On 30 November 2026 I went through 131 screens of the demo by hand (decision 0014). The tables had the same faults on many screens: numbers stood at the start of their cells in proportional figures (the reports of Ridgeway Freight: 119 of 119 cells; a media kit: 120 of 120; shift costs: 90 of 90), none of the 18 tables over 20 rows kept its header in view, and cut text offered no way to read it whole (a crew plan: 129 items; Riverside's coaches: 44).

The next day the runtime audit got rules for each of these. Its first run on 1 December covered 197 screens in four passes (1440px and 390px, light and dark):

Zero means no finding and no exception left in scripts/review-exceptions.mjs; table-scroll, the rule that a table never scrolls sideways, stood at zero by then too. The fixes went into the kit, not into each screen, which is why the numbers could fall that fast: decision 0020 lists them.

A column says what it holds

Every DataTable column carries meta: { kind }, and there is no width or alignment of its own to set. The kind decides both, and whether the cells use tabular figures. The widths in the table above are not a design opinion: they are the commonest width the demo used for each job on 29 October 2026, measured over 400 columns, after a review found the people column at two widths in two tables of one app.

Three details matter more than they look:

  • IDs are not numbers. An order number like PR-2026-0118 keeps proportional figures, because tabular figures in Inter widen its hyphens. It reads as text, starts at the left and is never summed.
  • One width per kind on a screen. In a table at least 64rem wide every kind keeps its width as a floor. Without it a title column that takes the free width squeezed the rest to their text, and two money columns of one recipe table came out 106 and 76px wide. The audit's column-kinds compares every pair of same-kind columns on a screen.
  • The kind is checked twice. The type rejects a meta without a kind; npm run check:columns catches a column with no meta at all, which TypeScript would let through as a title.

What tabular figures are and why they compare is in the glossary.

Figures end at the cell's edge

The audit's numeric-cells rule: a number in any table or grid ends at the cell's end edge and has tabular figures. Dates, times, ranges and phone numbers are not numbers here, and neither is a cell of an id, date, datetime or period column. A number inside a control that fills its cell, a heatmap's chip, ends at the control's inner edge.

Decision 0020 adds two rules about what goes in the cell:

  • The unit goes into the header. "Hours", "kg": then the figures line up alone. Money keeps its currency in the value.
  • A level in words stays before the number. "Under target 26.3 %", so the figures still end at the same edge.

The same applies to tables an app writes by hand outside DataTable: a rota's totals, a budget's lines, a handbook's table of figures. The 370 findings of the first run came from those as much as from DataTable columns without a kind.

Long tables keep their header

A DataTable with more than 20 rows on its page sticks its header to the screen's scroll region; a shorter one scrolls whole. The threshold is the audit's, and the second half of the rule came from a mistake: a header floating over three rows read as a glitch, and the rows passing under it sat beside its sort buttons, which axe counted as targets too close together (the rentals desk again).

Two parts make the sticking work:

  • No scroll container of its own. The table's frame scrolls sideways only while the table is really wider than it (data-overflow-x); a frame that always scrolled would hold the header inside itself instead of the page.
  • The sort button fills the header. Its hit area runs the header band's whole 36px height, while the focus ring stays around the words.

The sticky header entry covers the term and the grouped lists, whose row controls step out of the way under a stuck group header.

Phones fold, they do not scroll

A table never scrolls sideways on a phone (AGENTS.md, Responsive; the audit's table-scroll and horizontal-overflow). A less important column gets hideOnMobile: true and hides where the table is narrower than 42rem; its value moves into a cell that stays, through CellStack with secondaryOnMobile. The rentals code above does exactly that: the counts hide, and the item's second line says how many are out and how many are out of hire.

The width is the table's own, a container query, not the window's. So the same list folds beside an open record panel at 1440px as it does on a phone. For a table with more columns than room at laptop width, hideBelow: "xl" hides the least important column below 72rem (an accountant's name, a price before VAT) instead of squeezing the rest.

Cut text can be read whole

A cell that cuts its text uses the kit's Truncate, through the column's fill or clip. It offers the whole text only when the text is really cut: on hover, from the keyboard when the link around it takes focus (or by a tab stop of its own when it sits in no control), and on touch with a tap. A title attribute is not enough where the text is the main content of the cell, because neither a keyboard nor a finger can open it.

The rule that matters more comes before the tooltip: text cut in every row is a column too narrow or a text too long. Decision 0020 fixed those by shortening the words: an order's items read "Salvador Santa Ana +1", a crew chip shows only the site's short name and puts the contract number in its tooltip. The truncation entry explains the technique; the audit's truncation-access counts every cut text without a way to read it.

What you get in 2.1 and what comes next

The column kinds, hideOnMobile, hideBelow and CellStack are in 2.1. The changes of 2 December 2026 (the header that sticks past 20 rows, the width floors, clip and the reworked Truncate, the full-height sort button) and the audit rules numeric-cells, sticky-head and truncation-access live in the repository and come with the next release; 2.1 has the older npm run audit, with layout rules and axe. The UI check bookmarklet runs the new rules on any screen today, yours included.

The component itself, its props and a live preview are on the DataTable page.

A prompt for your coding tool

Paste this into Claude Code, Cursor or another tool working in an app built on Meadowstack:

text
Review every table on the screens I name (DataTable and tables written by hand).
1. Give every DataTable column meta: { kind } from the kit's columnKinds:
   id, title, text, person, status, date, datetime, period, money, number,
   meter, actions. Never set a width or text alignment on a column yourself.
2. Money and number columns: values end at the cell's end edge with tabular
   figures. Move units other than the currency into the header ("Hours", "kg").
   Do not use tabular figures on ids like PR-2026-0118.
3. On a phone no table scrolls sideways: mark the less important columns
   hideOnMobile: true and fold their values into a visible cell with CellStack
   secondaryOnMobile. Keep the title and the amount visible.
4. A hand-written table that can pass 20 rows gets a sticky header (sticky top-0,
   the page colour under it).
5. Cut text goes through the kit's Truncate (fill or clip on the column). If a
   text is cut in nearly every row, shorten the words or widen the column
   instead of adding a tooltip.
Then run npm run check, and list each change with its file.

A real column definition

apps/demo/src/modules/rentals/pages/stock.tsx
const fleetColumns: ColumnDef<Item>[] = [
  {
    id: "polozka",
    accessorKey: "name",
    header: tx("Položka", "Item"),
    meta: { kind: "title" },
    cell: ({ row }) => {
      const level = levels[row.original.id]!;
      return (
        <CellStack
          primary={<span className="font-medium text-fg">{row.original.name}</span>}
          secondary={
            <>
              {row.original.sport ? `${sportName[row.original.sport]}, ` : ""}
              {tx(
                `venku ${level.out}, mimo provoz ${level.damaged}`,
                `${level.out} out, ${level.damaged} out of hire`,
              )}
            </>
          }
          secondaryOnMobile
        />
      );
    },
  },
  {
    id: "celkem",
    accessorFn: (item) => levels[item.id]!.total,
    header: tx("Celkem", "In all"),
    meta: { kind: "number", hideOnMobile: true },
    cell: ({ getValue }) => <span className="text-fg-muted">{getValue<number>()}</span>,
  },
  {
    id: "venku",
    accessorFn: (item) => levels[item.id]!.out,
    header: tx("Venku", "Out"),
    meta: { kind: "number", hideOnMobile: true },
    cell: ({ getValue }) => (
      <span className={getValue<number>() ? "text-fg" : "text-fg-muted"}>{getValue<number>()}</span>
    ),
  },
  {
    id: "mimo",
    accessorFn: (item) => levels[item.id]!.damaged,
    header: tx("Vadné", "Faulty"),
    meta: { kind: "number", hideOnMobile: true },
    cell: ({ getValue }) => (
      <span className={getValue<number>() ? "text-fg" : "text-fg-muted"}>{getValue<number>()}</span>
    ),
  },
  {
    id: "volne",
    accessorFn: (item) => levels[item.id]!.available,
    header: tx("K dispozici", "Available"),
    meta: { kind: "meter" },
The hire fleet at Riverside Sports Club's rentals desk in the demo: the item is the title and folds its counts under its name on a phone, three counts are number columns that hide there, and the free stock is a meter.

When the header sticks

packages/kit/src/components/data-table.tsx
// A table of more than 20 rows under its header (group heads, "show all" and the total count, as in the audit's
// sticky-head) keeps the header in view; a shorter one scrolls whole. A header floating over three rows read as a
// glitch, and the rows passing under it sat beside its sort buttons (axe's target-size, Riverside's rentals desk,
// 2 Dec 2026).
const bodyRows = groups
  ? groups.reduce(
      (sum, group) =>
        sum + 1 + group.listed.length + (!group.collapsed && group.shown.length < group.rows.length ? 1 : 0),
      0,
    )
  : shownRows.length;
const sticky = bodyRows + (hasFooter ? 1 : 0) > 20;
DataTable counts the rows under its header, group heads and the total row included, and sticks the header only past 20 (decision 0020).

Questions

Why are IDs not right-aligned like numbers?

An order or invoice number is a name made of digits, not a quantity: nobody sums or compares it. It starts at the left like text and keeps proportional figures, because tabular figures widen its hyphens.

Why does a short table not get a sticky header?

A header floating over a few rows reads as a glitch, and rows passing under it crowd its sort buttons. Past 20 rows the header is worth keeping in view; below that the whole table scrolls with the page.

Where does the unit go in a column of figures?

Into the header, so the figures line up on their own: Hours, kg. Money is the exception and keeps its currency in each value.

Is a title attribute enough for cut text?

Not where the text is the main content of the cell. A title opens only under a mouse; the kit's Truncate also opens from the keyboard and on a tap, and only when the text is really cut.

Can I check my own tables against these rules?

Yes. The UI check bookmarklet runs the runtime audit's rules, these included, on any screen in your browser.

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 framework
  • Have 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