Skip to content
GitHub (opens in a new tab)

Table

Simple semantic table for invoices, lists and text rows.

stableOrganismcontracts/table.json

Preview

Table

Simple semantic table for invoices, lists, and text rows. Search and filters belong on DataTable. Not TableHeader/TableRow/TableCell cousins.

Master

Invoices. Caption sits under the grid. Footer holds the total. Amount hugs the right edge. Medium rows. Variants shows sorting, states and cell values.

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
INV004PaidCredit Card$450.00
INV005PaidPayPal$550.00
INV006PendingBank Transfer$200.00
INV007UnpaidCredit Card$300.00
Total$2,500.00

Usage

Caption sits under the grid; footer holds the total; Amount hugs the right edge.

Do's

  • Listing invoices, products, or other short text rows
  • Inside Section on dashboard or list-detail patterns
  • Marking the one row a person should look at first, like the next charge in a billing schedule (rowTone highlight)
  • Short, airy lists inside a Card where rows read by spacing, like a billing schedule (rowDividers none)
  • Screens where the header should sit flat with the rows, like a run's handoffs under its lanes (headerDivider none)

Don'ts

  • Search, filters, selection, or column settings — use DataTable
  • Editable cells — use DataGrid
  • Layout for metrics — use Scoreboard
  • Forms — use Field and inputs
  • Usage against a plan limit — use UsageList
<Table
  caption="A list of your recent invoices."
  columns={[
    { key: "invoice", header: "Invoice", emphasis: true },
    { key: "status", header: "Status" },
    { key: "method", header: "Method" },
    { key: "amount", header: "Amount", numeric: true, align: "end" },
  ]}
  rows={[
    { invoice: "INV001", status: "Paid", method: "Credit Card", amount: "$250.00" },
    { invoice: "INV002", status: "Pending", method: "PayPal", amount: "$150.00" },
  ]}
  footer={{ label: "Total", value: "$2,500.00" }}
/>

Simple semantic table for invoices, lists, and text rows, with optional sort, row menu, sticky header, loading, empty and error states, row dividers on or off, and one optional highlighted row. Search and filters belong on DataTable. One piece.

When to use

  • Listing invoices, products, or other short text rows
  • Inside Section on dashboard or list-detail patterns
  • Marking the one row a person should look at first, like the next charge in a billing schedule (rowTone highlight)
  • Short, airy lists inside a Card where rows read by spacing, like a billing schedule (rowDividers none)
  • Screens where the header should sit flat with the rows, like a run's handoffs under its lanes (headerDivider none)

When not to use

  • Search, filters, selection, or column settings — use DataTable
  • Editable cells — use DataGrid
  • Layout for metrics — use Scoreboard
  • Forms — use Field and inputs
  • Usage against a plan limit — use UsageList

What an agent reads

import { Table } from "agentic-ds-kit";
must
  • Column headers in thead with th scope=col
  • Optional caption describes the table and sits below
  • Empty state is one td with colSpan=columns.length and emptyLabel
  • Optional footer is tfoot with label spanning leading columns and value end-aligned
  • Narrow container keeps column min-width and scrolls horizontally; the scroller is a focusable region
  • Sortable th has aria-sort none | ascending | descending; the header label is a native button, so Enter and Space sort
  • Row menu column th has visually hidden text Actions; each menu is named Actions for <first cell>
  • state loading sets aria-busy on the region; state empty is role=status; state error is role=alert with Try again
  • With stack, headers stay in the table for screen readers; the row link is a real link in the first cell
  • rowTone highlight is visual only: the row's own text says why it stands out (not colour alone). It adds no ARIA state and is not selection
  • rowDividers is visual only: rows stay native tr in tbody and the header keeps its line, so the table reads the same to screen readers
defaults
  • size md
  • emptyLabel No results.
  • stickyHeader false
  • rowActionsAs menu
  • errorMessage Couldn’t load this table.
  • stack false
  • rowDividers default
  • headerDivider default
stops if
  • Do not invent TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, or TableCaption cousins
  • Do not compose HeaderCell — header cells stay on DataTable. Cell is fine in rows
  • Search, filters, selection — use DataTable
  • Editable in-place rows — use DataGrid
  • Do not add @tanstack/react-table
  • Do not squash columns to the container — overflow-x on the wrapper
  • Do not use raw hex
  • Do not build usage rows from a Table with a Progress column — use UsageList
  • Do not put a second menu or icon buttons in a row — one rowActions menu, last
  • Do not make stack the default — it is opt-in
  • Do not sort currency or date strings lexically — give the column sortValue
  • Do not highlight more than one row, or use highlight for selection — selection belongs on DataTable
  • Do not make highlight the only sign — say why the row stands out in its own text, like Next charge
  • Do not restyle rows with className or tr overrides for emphasis — use rowTone
  • Do not drop dividers on dense or wide tables where the eye must follow a row across many columns — keep the default
  • Do not remove row lines with className or tr overrides — use rowDividers
  • Do not use headerDivider to hide row dividers — use rowDividers for that

From contracts/table.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
columnsarrayYes—numeric or align end right-aligns the column and its header (a sortable number header keeps its icon on the right). emphasis or the first column is medium + text-primary. sortable makes the header a button: ascending, descending, then off (local state only). sortValue returns what to sort by (numbers and Dates compare numerically, strings locale-aware); without it, a numeric column sorts by the digits in its text and others by text. sortValue is a function, so build the columns in a client component.
rowsarrayYes—Values render in native td. Plain strings and numbers, or ReactNode such as kit Cell (badge, avatar, link) or Badge. The first column's text (or its Cell label) names the row.
captionstringNo—Renders below the grid (caption-side bottom). Not a heading above the table.
sizesm | md | lgNomdmd rows and header are 40px, one line. sm a hair tighter, lg a hair roomier. Do not recreate DataTable 3–4rem rows.
emptyLabelstringNoNo results.Shown as a small Empty (kind no-data) in one td with colSpan when rows is empty or state is empty. Say why it is empty.
footerobjectNo—Renders tfoot one row: label in a td colSpan={columns.length-1}, value in last td end-aligned.
stickyHeaderbooleanNofalseThe header row stays in view while the body scrolls. Give the Table a height (style or className) so the region scrolls.
rowActionsfunctionNo—(row, index) => CellAction[]. One row menu (Cell type actionMenu) in a last 56px column with no visible header text, named Actions for <first cell>. Return [] to leave a row without a menu.
rowActionsAsmenu | iconsNomenumenu: one row menu (Cell actionMenu). icons: each action as an icon-only ghost Button (Cell actionIcons, up to 3), named by its ariaLabel, like Edit Onboarding part 2 of 3, 15 Dec. Use icons for one or two row actions the person scans for; the column stays 56px with no visible header text, so footer totals stay under their column.
stateloading | empty | errorNo—loading: header stays, rows are Skeleton bars, region aria-busy. empty: Empty with emptyLabel. error: LoadError with errorMessage and onRetry. Without state, rows render (and rows=[] is empty).
errorMessagestringNoCouldn’t load this table.state error: what failed, named, like Couldn’t load invoices.
onRetryfunctionNo—() => void. state error: shows the Try again Button.
stackbooleanNofalseOpt-in. Below 480px (container width) each row stacks into two lines: the first column and the last number column on top, the other columns below in small muted text. Headers stay for screen readers.
rowHreffunctionNo—(row, index) => string. The first cell becomes a link to the row. With stack, the whole stacked row is the link target; the row menu stays its own control.
rowTonefunctionNo—(row, index) => "default" | "highlight". highlight draws the row as a rounded shape (radius.surfaceSm) tinted with status.infoSubtle and edged all round with status.infoBorder, so it reads with or without row dividers. Use it for the one row the person should look at first, like the next charge. Without it, every row is default.
rowDividersdefault | noneNodefaultnone drops the lines between body rows (the header and footer lines stay) and rounds the hover tint. The header turns compact: labels sit space.2 over the header line, and space.3 separates that line from the first row. Rows read by spacing. Use it for short lists inside a Card.
headerDividerdefault | noneNodefaultnone drops the line under the header row, so the header sits flat with the rows. Body row lines stay; rowDividers controls those. default keeps the header line (no change for existing tables).
  • Component
    →

    DataTable

    Framed dataset with search, filters, column settings, and a caption title.

  • Component
    →

    DataGrid

    An editable table: people click a cell to add or change its content, like rule conditions, line items, or mappings.

  • Component
    →

    Scoreboard

    Metrics strip of kit Scorecards: two to six figures, and the only metric picker.

  • Component
    →

    Field

    One labeled control with optional hint and an error or success message.