Home / Primitives / Table

Table

The workhorse data surface. Sortable, sticky-header, row select, striped, two densities — used wherever the operator scans a list of records.

Stable .table · .dtable Primitive · semantic

Primitive vs pattern.

Per audit-reuse D-6, .table remains the bare semantic primitive — header / row / cell with sensible defaults. For rich features (data toolbar, sortable columns, row select, pagination), use the x-data-table pattern, which wraps .dtable. Legacy .data-table markup aliases to .dtable.

Default

A plain table — left-aligned text, right-aligned numbers, hairline rows.

Receipt Till Cashier Items Total (USD)
R-1928102Tariro M.717.21
R-1928202Tariro M.24.50
R-1928301Blessing K.1242.80
R-1928403Tendai N.12.10
Receipts list .table

Sortable & sticky header

Header sticks when the table scrolls. Sortable columns show a caret in the active sort direction.

SKU Product On hand Reorder Branch
SKU-0184Mealie meal · 10 kg12840Park Centre
SKU-0185Cooking oil · 2 L4225Park Centre
SKU-0186Sugar · 2 kg930Avondale
SKU-0187Bread flour · 2 kg6120Avondale
SKU-0188Soap bar · 200 g240100Mazowe
SKU-0189Salt · 1 kg1240Mazowe
SKU-0190Rice · 5 kg8830Park Centre
Scrollable + sticky header · sorted by SKU ascending .dtable .sortable.asc

Row select

Checkbox column for bulk actions. Selected rows tint brand-soft.

Supplier National ID Last load (kg) Status
Sipho Moyo00-184273-A-003.218Cleared
Tendai Mhuri00-184274-B-002.140Cleared
Rumbidzai Chiweshe00-184275-C-001.890KYC due
Kuda Mapfumo00-184276-D-004.020Pending
Selectable rows tr.selected

Striped & density

Striped rows for long lists. Compact density (28 px) for high-volume reconciliation; comfortable (44 px) when readability matters more than density.

AccountDebitCredit
1100 Cash240.00
1200 Receivables240.00
4100 Sales208.70
2200 VAT output31.30
Compact & striped
28 px rows · zebra
BranchTills open
Park Centre3 / 4
Avondale2 / 2
Mazowe1 / 2
Comfortable
44 px rows · spacious

Parts

PropertyValueNotes
row height36 px default28 compact · 44 comfortable
header11 px · uppercase · text-subtleSticky on scroll containers
cell padding8 px 12 pxNumeric cells use mono
numeric colright-aligned · tabular-nums.num modifier
selected row--brand-soft filltr.selected
hover--surface-mutedWhole row tint

Do & don't

Do

Right-align numbers and use tabular nums. Operators compare totals down a column.

Don't

Centre-align money. Decimals stop lining up and the eye can't scan.

Do

Make the table scrollable horizontally on small screens — keep all columns visible, never collapse them.

Don't

Hide columns behind a "more" toggle. The operator needs to see what's there.

Do

Use compact density (28 px) when the user is reconciling — they want as many rows in view as possible.

Don't

Mix densities on the same page. Pick one based on the dominant task.

Code

<!-- Sortable, sticky-header data table -->
<div style="max-height: 320px; overflow: auto;">
  <table class="dtable">
    <thead><tr>
      <th class="sortable asc">SKU</th>
      <th class="sortable num">On hand</th>
    </tr></thead>
    <tbody>
      <tr class="selected">…</tr>
    </tbody>
  </table>
</div>

Related

For the full data-table pattern with toolbar, see Data table. For pagination controls, see Pagination.