Data Table

A table driven by data and columns, with sorting, search, row selection and pagination.
Stable
Web
iOS
Android
@advui/data
Source

Sort, search, select and page

Status
River Delta Relief
Food Security
Labutta
15,900
Planned
Shwe Health
Health
Hlaing Tharyar
12,400
Ongoing
Green Valley
WASH
Pakokku
9,800
Planned
Green Valley
WASH
Sittwe
8,300
Ongoing
Shwe Health
Health
Mawlamyine
6,100
Completed
1–5 of 7

Installation

pnpm
pnpm add @advui/data
npm
npm install @advui/data

Usage

import { DataTable, type DataTableColumn } from '@advui/data'

const columns: DataTableColumn<Project>[] = [
  { id: 'organization', header: 'Organization', sortable: true },
  { id: 'beneficiaries', header: 'Reached', sortable: true, align: 'end' },
]

<DataTable aria-label="Projects" data={projects} columns={columns} pageSize={10} searchable selectable />

Examples

Loading and empty

Code

API reference

DataTable

Also takes the Table props: `variant`, `size`, `striped`, `minWidth`.
PropTypeDefaultDescription
data requiredT[]—The rows.
columns requiredDataTableColumn<T>[]—Column definitions (below).
getRowId(row, index) => string`row.id`, then the indexStable id for selection and React keys.
getRowLabel(row) => string—Names a row’s checkbox ("Select INV-001"). Default: its id.
sort{ column: string; direction: 'ascending' | 'descending' } | null—Sorted column. Pressing a header cycles ascending, descending, none.
defaultSort{ column: string; direction: 'ascending' | 'descending' } | null—Starting `sort` when uncontrolled.
onSortChange(sort: { column: string; direction: 'ascending' | 'descending' } | null) => void—Called with the new `sort`.
pageSizenumber—Rows per page. Without it every row is shown.
pagenumber—Current page, from 1. Sorting and searching go back to page 1.
defaultPagenumber—Starting `page` when uncontrolled.
onPageChange(page: number) => void—Called with the new `page`.
selectablebooleanfalseAdds a checkbox column and a "select all on this page" box.
selectedIdsstring[]—Selected row ids.
defaultSelectedIdsstring[]—Starting `selectedIds` when uncontrolled.
onSelectedIdsChange(selectedIds: string[]) => void—Called with the new `selectedIds`.
searchablebooleanfalseAdds a search field over the searchable columns.
searchstring—Search text (controlled or not).
defaultSearchstring—Starting `search` when uncontrolled.
onSearchChange(search: string) => void—Called with the new `search`.
filterRow(row, search) => boolean—Custom filter. Default: a column contains the text, ignoring case and accents.
toolbarReactNode—Controls next to the search field.
emptyReactNode—Shown when no row matches.
loadingbooleanfalsePlaceholder rows and `aria-busy`.
labelsPartial<DataTableLabels>—Search, checkbox, empty and status text, for translation.

DataTableColumn<T>

PropTypeDefaultDescription
id requiredstring—Key; the row field read by default.
header requiredReactNode—Header text.
accessor(row: T) => string | number | boolean | Date | null | undefined—Value to sort, search and show. Default: `row[id]`.
cell(row) => ReactNode—Custom cell content.
sortableboolean—Header becomes a sort button.
searchablebooleantrueInclude in the search.
align'start' | 'center' | 'end''start'Alignment of the header and cells, as on Table cells.
flexnumber1Share of the width, like CSS `flex-grow`.
widthnumber | SizeTokens—A fixed width instead of a share.

Accessibility

  • Built on Table: ARIA table roles, a name from aria-label or caption, and sort buttons with aria-sort.
  • Row checkboxes are named from getRowLabel ("Select Shwe Health, Mawlamyine"); the header box selects the page and is "mixed" when some are.
  • The search field is a named searchbox. The line under the table ("1 selected · 1–5 of 7") is a polite live region, so filtering and paging are announced.
  • While loading the wrapper has aria-busy and the placeholder rows are hidden.
Keyboard interactions
KeyAction
TabSearch field, sort buttons, checkboxes, then the pager.
Enter / SpaceSort by the focused column.
SpaceCheck the focused row.

Responsive behavior

Set minWidth so the table scrolls sideways on phones; the search field and pager wrap.

Platform notes

Web
Sorting, searching and paging run in the browser on data. For server-side data, control sort, search and page and pass only the current page.
iOS
Same features; the sort button’s name says how the column is sorted.
Android
Same as iOS.
Since v0.6.0Last updated Nov 2, 2026Edit this page on GitHub