Skip to the page
Supply UI

Table

A table. Use plain <thead>, <tr>, <th>, <td> inside. Where its columns do not fit (a phone), each row becomes a block: the first cell is its title, the others sit under it with their column's name. With scroll it keeps its columns and scrolls sideways instead: for a table read down its columns (sorting, many figures).

Preview

CustomerStatusDateAmount
Noor HaddadPaid12 Nov£120.00
Mira KovacPending13 Nov£80.00
Otis BrandtFailed14 Nov£45.50

Use

The code of the preview above
import { Badge, Table } from '@/components/ui';

<div className="ui-grow">
  <Table>
    <thead>
      <tr>
        <th>Customer</th>
        <th>Status</th>
        <th>Date</th>
        <th className="ui-num">Amount</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Noor Haddad</td>
        <td><Badge tone="success" dot>Paid</Badge></td>
        <td className="ui-mono">12 Nov</td>
        <td className="ui-num">£120.00</td>
      </tr>
      <tr>
        <td>Mira Kovac</td>
        <td><Badge tone="warning">Pending</Badge></td>
        <td className="ui-mono">13 Nov</td>
        <td className="ui-num">£80.00</td>
      </tr>
      <tr>
        <td>Otis Brandt</td>
        <td><Badge tone="danger">Failed</Badge></td>
        <td className="ui-mono">14 Nov</td>
        <td className="ui-num">£45.50</td>
      </tr>
    </tbody>
  </Table>
</div>

This page as text, for an AI

Options

OptionTypeWhat it does
scroll booleanKeeps its columns where they do not fit and scrolls sideways, in place of turning rows into blocks.

It also takes the 289 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.

Without React

The same look on any HTML, with the classes ui-table-wrap > ui-table.

With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:

components/card.csscomponents/table.csscomponents/input-group.csscomponents/table-sorting-chosen-rows.css

In the examples

Small screens made with it and the rest of the kit. They work: click, type and choose in them.

This week, by product

Linen tote18%
Enamel mug9%
Wall calendar44%
Sticker sheet2%
Which ones sell A line for each product, the change beside it
ClientDueAmountReminder
Northwind Joinery#039831 days late€2,780.00
Kestrel Studio#041212 days late€1,200.00
Lumen Bakery#0420In 3 days€340.00
Who still owes Nudge a client and the row remembers
Invoice 0421Kestrel Studio
Draft
WorkQtyPriceLine
€900.00
€240.00
Subtotal
€1,140.00
VAT 21%
€239.40
Total
€1,379.40
An invoice that adds up Change a quantity or a price; the lines and VAT follow
In€4,320.00
Out€831.00
Left€3,489.00
Kestrel StudioWebsite€1,200.00
Lumen BakeryMenu design€340.00
Northwind JoinerySignage€2,780.00
In, out, and what is left Three numbers on top, the rows under two tabs

Showing things: states, do and don’t

Data in rows. Plain <thead>, <tr>, <th>, <td> inside; className="ui-num" on number cells. Where its columns do not fit, each row becomes a block: the first cell is its title, every other cell a line with its column's name (a heading in ui-sr-only names none: such cells share one line). With scroll it keeps its columns and scrolls sideways instead.

States. Lists, tables and boards have three more states besides their content: empty (Empty, with the first action inside), loading (Skeleton) and failed (Alert tone="danger"). A chosen row shows in ink, never in the brand colour.

Do

  • Put numbers, dates and codes in ui-mono (in a table cell, ui-num, which also aligns them).
  • Let a Table turn into blocks on a phone; give it scroll only when it is read down its columns.
  • Show a status in words and colour together (Badge tone="success" with "Paid"), never colour alone.

Don't

  • Don't put a card round a Table, List, Cells, Calendar or Empty: they draw their own box.
  • Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
  • Don't use the status colours (success, warning, danger, info) for anything but those meanings.