Data
Data table
Sort, filter, select and paginate rows.
Payments
Forty payments with sortable headers, debounced search, row selection with a floating bulk-action bar, a columns menu, page size and “Showing 1–10 of 40”. State is uncontrolled here.
| Actions | ||||||
|---|---|---|---|---|---|---|
Amara Okaforamara.okafor@example.com | Paid | Visa | Nov 28, 2025 | $12.00 | ||
Liam Brennanliam.brennan@example.com | Paid | Mastercard | Nov 27, 2025 | $91.19 | ||
Sofia Marchettisofia.marchetti@example.com | Refunded | Bank transfer | Nov 26, 2025 | $170.38 | ||
Noah Fischernoah.fischer@example.com | Paid | PayPal | Nov 25, 2025 | $249.57 | ||
Yuki Tanakayuki.tanaka@example.com | Failed | Visa | Nov 24, 2025 | $328.76 | ||
Priya Ramanpriya.raman@example.com | Pending | Mastercard | Nov 23, 2025 | $407.95 | ||
Mateo Alvarezmateo.alvarez@example.com | Pending | Bank transfer | Nov 22, 2025 | $487.14 | ||
Elena Petrovaelena.petrova@example.com | Paid | PayPal | Nov 21, 2025 | $566.33 | ||
Jonas Lindqvistjonas.lindqvist@example.com | Paid | Visa | Nov 20, 2025 | $645.52 | ||
Hana Kimhana.kim@example.com | Paid | Mastercard | Nov 19, 2025 | $724.71 |
Showing 1–10 of 40
Page 1 of 4
40 payments, sorted by Date descending
When to use
- Lists people scan, compare and act on: payments, users, orders, logs.
- A static, read-only grid needs no state: use
Tabledirectly. - Server-side data: control page, sort, search and filters and feed the table the page you fetched (the helpers only operate on what you pass in).
Controlled state, filters and loading
Search, sort, per-column filters and the page are held by the parent. The role column renders a select in the filter row; loading swaps rows for skeletons without changing the layout.
Sorted by seats (desc), page 1
| Priya Raman | Admin | Support | 14 |
| Amara Okafor | Owner | Platform | 12 |
| Yuki Tanaka | Editor | Platform | 9 |
| Liam Brennan | Admin | Growth | 8 |
| Elena Petrova | Editor | Design | 6 |
Showing 1–5 of 8
Page 1 of 2
8 members, sorted by Seats descending
API
DataTable
| Prop | Type | Default | Description |
|---|---|---|---|
| columns | DataTableColumn<T>[] | — | Column definitions (see below). |
| data | readonly T[] | — | The rows. |
| getRowId | (row, index) => string | — | Stable id per row. Default: row.id, else the index. |
| label / caption / rowLabel | string / ReactNode / string | — | Table name, visible caption, and the noun used in counts ("payment"). |
| striped, compact, bordered, stickyHeader, maxHeight | Table props | — | Passed to Table. |
| searchable | boolean | true | Global search field. |
| search / defaultSearch / onSearchChange | string | — | Controlled or uncontrolled query. Applied after searchDebounce (200ms). |
| sort / defaultSort / onSortChange | DataTableSort | null | — | { id, direction: "asc" | "desc" } or null. |
| columnFilters / defaultColumnFilters / onColumnFiltersChange | Record<string, string> | — | Per-column filter values. |
| selectable | boolean | false | Checkbox column. |
| selectedRowIds / defaultSelectedRowIds / onSelectedRowIdsChange | string[] | — | Selection, persists across pages. |
| bulkActions | ({ selectedRows, selectedIds, clearSelection }) => ReactNode | — | Content of the floating bar. |
| paginated | boolean | true | Paginate rows. |
| page / defaultPage / onPageChange | number | — | 1-based page. |
| pageSize / defaultPageSize / onPageSizeChange | number | 10 | Rows per page. |
| pageSizeOptions | number[] | [10, 25, 50] | Choices in the rows-per-page select. |
| columnsMenu | boolean | true | Columns visibility menu. |
| columnVisibility / defaultColumnVisibility / onColumnVisibilityChange | Record<string, boolean> | — | Visibility by column id. |
| loading | boolean | false | Skeleton rows, aria-busy. |
| emptyState | ReactNode | — | Replaces the default "No results" content. |
| toolbar | ReactNode | — | Extra controls before the Columns menu. |
DataTableColumn
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | — | Unique, stable. |
| header | ReactNode | — | Header content. |
| label | string | — | Plain name for the columns menu (defaults to a string header). |
| accessor | keyof T | (row) => unknown | — | Value for display, sort, search and filter. |
| cell | ({ row, value, index, rowId }) => ReactNode | — | Custom cell. |
| sortable / compare | boolean / (a, b) => number | — | Sort button and optional comparator. |
| searchable / searchText | boolean / (row) => string | — | Global search participation and text. |
| filter / filterFn | (ctx) => ReactNode / (row, value) => boolean | — | Filter-row control and predicate. |
| align, width, hidden, hideable | misc | — | Layout and visibility. |
The pure helpers are exported too: dataTableFilterRows, dataTableSortRows, dataTablePaginate, dataTableCompareValues and dataTableNextDirection.
Keyboard
| Key | Action |
|---|---|
| Tab | Moves through search, columns menu, sort buttons, checkboxes, row actions and the pager. |
| Enter / Space | Activates a sort button, toggles a checkbox, presses prev / next. |
| Esc | In the search field, clears it. In the columns menu, closes it. |
| Arrow keys | Move between items in the columns menu. |
Accessibility
- Native table; sortable headers expose aria-sort and contain a real button.
- Every checkbox has a name (“Select all rows on this page”, or selectRowLabel).
- A polite live region announces the result count and sort after changes; loading sets aria-busy.
- Selection is never colour alone: the checkbox is checked and the footer counts it.
Motion
- The bulk bar rises in (380ms soft rise) and exits faster (160ms). The sort arrow and empty state pop in.
- Reduced motion keeps every state change and drops the movement.