Data table on React Aria: a card with an optional toolbar and pagination footer, a grey header band, keyboard navigation, sortable columns, row selection, row actions, two densities and skeleton loading.
Data table
The full data table: a TableToolbar with a filter, row selection (selectionMode="multiple": checkboxes, Space and Shift-click), sortable Due and Amount columns, row actions, Pagination in the footer and a Normal / Compact density switch. Arrow keys move through the grid.
Total results
5 invoices
| Client | Status | Due | Amount | Actions | |
|---|---|---|---|---|---|
Denzing INV-1042 | Overdue | Nov 02, 2026 | $4,800 | ||
Halo Coffee INV-1043 | Paid | Nov 10, 2026 | $2,150 | ||
Northwind INV-1044 | Sent | Nov 21, 2026 | $7,300 | ||
Lumen Labs INV-1045 | Draft | Nov 28, 2026 | $1,290 | ||
Orbit Studio INV-1046 | Sent | Dec 04, 2026 | $3,640 |
Installation
Copies the component into src/design-system/ as your own source, with only the files it needs.
npx avesk-ui@latest add tableBrings the 4 files it builds on (checkbox.tsx, glyph.tsx, scroll-area.tsx, skeleton.tsx). The first time, it also adds the tokens and the cn() helper, imports the tokens in globals.css and installs clsx and tailwind-merge, plus react-aria-components which this component is built on. Files already in your project are kept unless you add --force.
Import
Lives in src/design-system/components/table.tsx.
import { TableCard, TableToolbar, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, TableActions, TableSkeletonRows, TableEmptyState, CellText } from "@/design-system/components/table";Usage
<TableCard
toolbar={<TableToolbar caption="Total results" title="48 invoices">{filters}</TableToolbar>}
footer={<Pagination … />}
>
<Table aria-label="Invoices" selectionMode="multiple" sortDescriptor={sort} onSortChange={setSort}>
<TableHeader>
<TableColumn id="client" isRowHeader>Client</TableColumn>
<TableColumn id="due" width={144} allowsSorting>Due</TableColumn>
</TableHeader>
<TableBody renderEmptyState={() => <TableEmptyState>No invoices match.</TableEmptyState>}>
<TableRow id="INV-1042">
<TableCell><CellText primary="Denzing" secondary="INV-1042" /></TableCell>
<TableCell>Nov 02</TableCell>
</TableRow>
</TableBody>
</Table>
</TableCard>Examples
Default
A projects table: TableCard frames it, TableColumn width sets column widths, isRowHeader names each row, CellText stacks two lines.
| Project | Due | Status |
|---|---|---|
Brand refresh Denzing | Nov 28 | In review |
Packaging system Halo Coffee | Dec 4 | In progress |
Launch campaign Northwind | Dec 12 | Approved |
Sortable header
allowsSorting on a TableColumn plus sortDescriptor and onSortChange on the Table: click or Enter sorts, the chevron flips for ascending and aria-sort is set for you.
| Invoice | Client | Amount |
|---|---|---|
| INV-1044 | Northwind | $7,300 |
| INV-1042 | Denzing | $4,800 |
| INV-1043 | Halo Coffee | $2,150 |
Row selection
selectionMode="multiple" adds a checkbox column: the header one selects all and shows a dash when only some are picked; selected rows turn grey. Control it with selectedKeys and onSelectionChange.
| Name | Role | |
|---|---|---|
Maya Chen maya@avesk.studio | Senior designer | |
Leo Park leo@avesk.studio | Brand designer | |
Ana Ruiz ana@avesk.studio | Motion designer | |
Sam Okafor sam@avesk.studio | Producer |
Compact
size="sm" on Table: 36px header and 44px rows for dense lists like payments.
| Date | Client | Method | Amount |
|---|---|---|---|
| Nov 14 | Denzing | Bank transfer | $4,800 |
| Nov 12 | Halo Coffee | Card | $2,150 |
| Nov 09 | Northwind | Bank transfer | $7,300 |
| Nov 03 | Lumen Labs | Card | $1,290 |
Loading
TableSkeletonRows fills the body with grey bars under the real header until the data arrives; set aria-busy on the Table.
Projects
Loading…
| Project | Due | Owner |
|---|---|---|
Index column
index on TableColumn and TableCell gives a narrow, centred "#" column.
| # | Designer | Active projects |
|---|---|---|
| 1 | Maya Chen Senior designer | 4 |
| 2 | Leo Park Brand designer | 3 |
| 3 | Ana Ruiz Motion designer | 2 |
Empty state
TableBody renderEmptyState returns a TableEmptyState: the header stays and a message explains why there are no rows, e.g. after a filter.
| Proposal | Client | Sent |
|---|---|---|
No proposals are waiting on a client reply. | ||
When to use
Use it when
- Comparing rows of the same kind across columns: projects, invoices, people
- Picking several rows for a bulk action (checkbox selection)
- Long lists that need sorting, a filter and pages
Don’t use it when
- Fewer than 3 columns or rich cards → Pressable cards in a grid
- Layout → CSS grid or flex
- There is no data at all yet → Empty state
Rules
- Compose Table > TableHeader (TableColumn…) + TableBody (TableRow > TableCell…); every TableRow needs an id, and the Table an aria-label
- Mark the column that names each row with isRowHeader
- Column widths come from TableColumn width; set Table minWidth so it scrolls inside TableCard
- Put the title, filters and search in TableCard toolbar (TableToolbar) and Pagination in footer
- md density by default; size="sm" for dense lists or when people ask for compact
- Sorting: allowsSorting on the column, sortDescriptor + onSortChange on the Table; sort the rows yourself
- Selection: selectionMode="multiple" (or "single") on the Table adds the checkbox column; control it with selectedKeys + onSelectionChange
- Row actions are small icon-only Buttons in TableActions, each with an aria-label naming the row
- Use TableSkeletonRows while loading, TableBody renderEmptyState with TableEmptyState when a filter matches nothing, EmptyState when there is no data at all
Properties
TableCard
| Prop | Type | Default |
|---|---|---|
toolbar | ReactNode | – |
footer | ReactNode | – |
className | string | – |
TableToolbar
| Prop | Type | Default |
|---|---|---|
caption | ReactNode | – |
title | ReactNode | – |
children | ReactNode | – |
className | string | – |
Table
| Prop | Type | Default |
|---|---|---|
aria-label * | string | – |
minWidth | number | 720 |
size | "sm" | "md" | "md" |
selectionMode | "none" | "single" | "multiple" | "none" |
selectedKeys | Selection | – |
onSelectionChange | (keys: Selection) => void | – |
sortDescriptor | SortDescriptor | – |
onSortChange | (descriptor: SortDescriptor) => void | – |
onRowAction | (key: Key) => void | – |
className | string | – |
TableColumn
| Prop | Type | Default |
|---|---|---|
id * | Key | – |
isRowHeader | boolean | – |
allowsSorting | boolean | – |
width | number | string | – |
index | boolean | false |
align | "start" | "end" | "start" |
className | string | – |
TableBody
| Prop | Type | Default |
|---|---|---|
renderEmptyState | () => ReactNode | – |
items | Iterable<T> | – |
TableRow
| Prop | Type | Default |
|---|---|---|
id * | Key | – |
highlight | boolean | false |
textValue | string | – |
onAction | () => void | – |
isDisabled | boolean | – |
className | string | – |
TableCell
| Prop | Type | Default |
|---|---|---|
index | boolean | false |
align | "start" | "end" | "start" |
className | string | – |
TableSkeletonRows
| Prop | Type | Default |
|---|---|---|
rows | number | 5 |
columns * | number | – |
TableEmptyState
| Prop | Type | Default |
|---|---|---|
children * | ReactNode | – |
CellText
| Prop | Type | Default |
|---|---|---|
primary * | ReactNode | – |
secondary | ReactNode | – |
leading | ReactNode | – |
* required
Accessibility
- A real ARIA grid (React Aria): Tab enters it, arrow keys move between rows and cells, Home/End jump
- Sortable headers sort on click or Enter and carry aria-sort; the chevron shows the direction
- Space toggles a row's selection; Shift-click and Shift-arrows select a range; the select-all checkbox shows a dash for some
- isRowHeader makes screen readers announce each row by its name; textValue names rows whose first cell isn't plain text
- The scroll area is focusable, so keyboard users can scroll a wide table with the arrow keys
- Set aria-busy on the Table while TableSkeletonRows show; the bars are hidden from screen readers
Related
Used in the Avesk app: Projects & Clients.