Tables
On this page
Kit tables show records in rows and columns. Add one attribute and the kit sorts them when a column header is clicked, and splits them into pages. Use them for anything from a handful of rows to a few hundred loaded at once.


Figure 1: A table with sortable columns, status badges, right-aligned numbers and paging
<section class="ph-card ph-card--flush">
<div class="ph-toolbar">...</div>
<div class="ph-table-wrap">
<table class="ph-table" data-ph-table data-page-size="25">
<thead>
<tr>
<th data-sort>Customer</th>
<th data-sort>Status</th>
<th data-sort="number" class="ph-num">Orders</th>
<th data-sort="date">Last order</th>
</tr>
</thead>
<tbody>
<tr>
<td>Olivia Bennett</td>
<td data-value="Active"><span class="ph-badge ph-badge--success">Active</span></td>
<td class="ph-num" data-value="42">42</td>
<td data-value="2026-11-16T06:42:00Z" title="16 Nov 2026, 6:42 am">2 hours ago</td>
</tr>
</tbody>
</table>
</div>
</section>
| Class or attribute | What it does |
|---|---|
.ph-table-wrap | Scrolls the table sideways on small screens instead of widening the page |
.ph-table | The table: 13px text, a sticky header row, a hover colour on rows |
data-ph-table | Turns on sorting and paging |
data-page-size="25" | Rows per page. Leave it out (or 0) to show every row. |
data-sort on a <th> | Makes the column sortable as text |
data-sort="number" / data-sort="date" | Sorts as numbers / dates |
data-value on a <td> | The value to sort by, when the cell shows something else ("2 hours ago") |
.ph-num | Right-aligns a column and uses tabular figures |
.ph-actions | A narrow column on the right for row buttons |
.ph-row-link | A row that opens something (pointer cursor) |
.ph-table--dense | Shorter rows |
Sorting and paging
- Clicking a sortable header sorts ascending; clicking it again sorts descending. The kit turns
the header into a button and sets
aria-sort, so it works with the keyboard and screen readers. - Sorting goes back to the first page.
- The paging control shows "1–25 of 128" and previous and next arrow buttons (read out as "Previous page" and "Next page").
- Rows you add to the table later are paged too.
Filtering
Set data-ph-hide on rows that don't match the search or filters. Paging counts only the visible
rows and goes back to the first page.
for (const row of tbody.rows) {
const match = row.textContent.toLowerCase().includes(query.toLowerCase());
row.toggleAttribute('data-ph-hide', !match);
}
Don't set hidden on rows yourself: paging uses it.
Dense and empty tables


Figure 2: A dense table and a table with no rows
<table class="ph-table ph-table--dense">...</table>
<tbody>
<tr class="ph-table-empty"><td colspan="4">No orders yet</td></tr>
</tbody>
For an empty list with a next step, show an empty state instead of the table.
How much data
| Rows | Use |
|---|---|
| Up to a few hundred, loaded at once | A kit table with data-ph-table |
| More, or growing without limit | Page, sort and filter on the server; render one page at a time in a kit table |
| Thousands already in the browser, or inline editing | The data grid |
React
import { DataTable, format, type Column } from 'ph-app-kit-react';
const columns: Column<Customer>[] = [
{ key: 'name', label: 'Customer', render: (customer) => customer.name },
{ key: 'orders', label: 'Orders', align: 'right', render: (customer) => format.number(customer.orders) },
];
<DataTable rows={customers} columns={columns} rowKey={(customer) => String(customer.id)} pageSize={25} onRowClick={openCustomer} emptyText="No customers yet" />
DataTable also supports row selection and grouping.
Guidelines
- The first column names the record and links to it (a real
<a>or button), so keyboard users can open rows. - Right-align numbers with
.ph-numand format them withphApp.format. - Show recent dates as relative times ("2 hours ago") with the full date in
title. - Show statuses as badges.
- Put a toolbar above every table.
Related
- Toolbar and search
- Data grid
- Page patterns: the list page