Table
Shows records with the same columns in rows, with density control, a sticky header and row states, built on a native HTML table.
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Revisar contestação | 0001234-56.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 12/12/2026 | Em revisão |
| Conferir petição inicial | 0004321-98.2026.8.26.0100 | Seguradora Norte | Camila Ribeiro | 09/12/2026 | Atrasada |
| Anexar procuração | 0007788-10.2026.8.26.0100 | Varejo Sul | Renata Barros | 15/12/2026 | Pendente |
| Protocolar recurso | 0002468-13.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 07/12/2026 | Concluída |
When to use
- To compare many records that share the same columns: tarefas, processos, revisores.
- When operators scan, sort and filter, and need the header visible while they scroll.
- To show a result set next to the filter controls.
When not to use
- One record with label and value pairs. Use Data list.
- A short list with a title and a detail per item. Use List.
- Nested data. Use Tree view.
- A table the operator edits cell by cell. Use the editable
DataTable, described below.
Anatomy
A table is built from parts that map to native elements.
| Part | Element | Role |
|---|---|---|
Table |
table |
Sets the density and wraps the table in a scroll container. |
TableHeader |
thead |
Sticks to the top of the container. |
TableBody |
tbody |
Holds the rows. isFetching dims it while data loads. |
TableFooter |
tfoot |
Totals or a summary row. |
TableRow |
tr |
A row. data-state="selected" marks it as selected. |
TableHead |
th |
A column header. |
TableCell |
td |
A data cell. |
TableCellTitle |
td |
The cell that names the row. Heavier text. |
TableCaption |
caption |
Names the table. Shown below it. |
Sizes
Density is a display preference. Keep the rows, selection and filters when it changes.
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Revisar contestação | 0001234-56.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 12/12/2026 | Em revisão |
| Conferir petição inicial | 0004321-98.2026.8.26.0100 | Seguradora Norte | Camila Ribeiro | 09/12/2026 | Atrasada |
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Revisar contestação | 0001234-56.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 12/12/2026 | Em revisão |
| Conferir petição inicial | 0004321-98.2026.8.26.0100 | Seguradora Norte | Camila Ribeiro | 09/12/2026 | Atrasada |
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Revisar contestação | 0001234-56.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 12/12/2026 | Em revisão |
| Conferir petição inicial | 0004321-98.2026.8.26.0100 | Seguradora Norte | Camila Ribeiro | 09/12/2026 | Atrasada |
| Density | Use for |
|---|---|
compact |
Dense work lists. Smaller text and tighter cells. |
regular |
Default. |
comfortable |
Tables with few rows, or with actions and tags in the cells. |
States
Selected rows
Set data-state="selected" on the row and show the selection with a checkbox that has its own accessible name.
| Tarefa | Revisor | Prazo | |
|---|---|---|---|
| Revisar contestação | Rafael Almeida | 12/12/2026 | |
| Conferir petição inicial | Camila Ribeiro | 09/12/2026 | |
| Anexar procuração | Renata Barros | 15/12/2026 |
Fetching
isFetching on TableBody dims the body while new data loads. Set aria-busy on the table too.
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Revisar contestação | 0001234-56.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 12/12/2026 | Em revisão |
| Conferir petição inicial | 0004321-98.2026.8.26.0100 | Seguradora Norte | Camila Ribeiro | 09/12/2026 | Atrasada |
| Anexar procuração | 0007788-10.2026.8.26.0100 | Varejo Sul | Renata Barros | 15/12/2026 | Pendente |
| Protocolar recurso | 0002468-13.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 07/12/2026 | Concluída |
Empty
Keep the header and show one row with a short message that says why it is empty.
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Nenhuma tarefa encontrada para os filtros aplicados. | |||||
Examples
Caption and footer
| Tarefa | Número do processo | Cliente | Revisor | Prazo | Status |
|---|---|---|---|---|---|
| Revisar contestação | 0001234-56.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 12/12/2026 | Em revisão |
| Conferir petição inicial | 0004321-98.2026.8.26.0100 | Seguradora Norte | Camila Ribeiro | 09/12/2026 | Atrasada |
| Anexar procuração | 0007788-10.2026.8.26.0100 | Varejo Sul | Renata Barros | 15/12/2026 | Pendente |
| Protocolar recurso | 0002468-13.2026.8.26.0100 | Banco Aurora | Rafael Almeida | 07/12/2026 | Concluída |
| Total de tarefas | 4 | ||||
Editable DataTable
DataTable from @repo/ui/data-table renders a grid whose cells read from a store, so editing one cell re-renders only that cell. It is display-only until you pass the editing slots from @repo/ui/data-table/editing. Column widths are in pixels, and editable: false locks a column.
Infinite table
InfiniteDataTable from @repo/ui/infinite-data-table is a sortable table that reveals more rows as the operator scrolls, through a load-more row that also works as a button. The caller owns the paging state, the sort and every label.
| Cliente | Status | ||
|---|---|---|---|
| Revisar contestação | Banco Aurora | 12/12/2026 | Em revisão |
| Conferir petição inicial | Seguradora Norte | 09/12/2026 | Atrasada |
| Anexar procuração | Varejo Sul | 15/12/2026 | Pendente |
| Protocolar recurso | Banco Aurora | 07/12/2026 | Concluída |
When loading fails, the row shows the error and a retry button.
| Cliente | Status | ||
|---|---|---|---|
| Revisar contestação | Banco Aurora | 12/12/2026 | Em revisão |
| Conferir petição inicial | Seguradora Norte | 09/12/2026 | Atrasada |
| Anexar procuração | Varejo Sul | 15/12/2026 | Pendente |
| Protocolar recurso | Banco Aurora | 07/12/2026 | Concluída |
Não foi possível carregar mais tarefas. | |||
Content
- Column headers are short nouns: “Prazo”, “Revisor”. Put units in the header, not in every cell.
- Use
TableCellTitlefor the cell that names the row, usually the first. - Format dates and amounts before rendering them. Align the format in a column.
- Write the empty message as a sentence: “Nenhuma tarefa encontrada para os filtros aplicados.”
Do and don’t
| Cliente | Prazo |
|---|---|
| Banco Aurora | 12/12/2026 |
| Varejo Sul | 15/12/2026 |
| Banco Aurora, prazo 12/12/2026 |
| Varejo Sul, prazo 15/12/2026 |
Accessibility
- Renders native
table,thead,tbody,tr,thandtd, so screen readers announce the column header for each cell. - Use
TableHeadfor column headers andTableCellorTableCellTitlefor data. Addscopeor acaptionwhen the table needs a name. - Set
aria-busy="true"whileisFetching, because the dimming is only visual. - A selected row is marked only by color. Always add a checkbox or a text with the selection.
InfiniteDataTablesetsaria-sorton the sorted column and gives each sort button anaria-labelfrom yourlabels.sortColumn. The load-more row is a button inside a polite live region.DataTableusesrole="grid"with row and column counts. PassariaLabelorariaLabelledByso the grid has a name.
Code
import {
Table,
TableBody,
TableCell,
TableCellTitle,
TableHead,
TableHeader,
TableRow,
} from "@repo/ui/table";
<Table density="regular">
<TableHeader>
<TableRow>
<TableHead>Tarefa</TableHead>
<TableHead>Revisor</TableHead>
<TableHead>Prazo</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCellTitle>Revisar contestação</TableCellTitle>
<TableCell>Rafael Almeida</TableCell>
<TableCell>12/12/2026</TableCell>
</TableRow>
</TableBody>
</Table>;
Props
Table| Prop | Type | Default | Description |
|---|---|---|---|
density | "comfortable" | "compact" | "regular" | regular | Row height and text size of the whole table |
TableBody| Prop | Type | Default | Description |
|---|---|---|---|
isFetching | boolean | — | Dims the body and pulses it while data loads. |
TableRow| Prop | Type | Default | Description |
|---|---|---|---|
data-state | "selected" | — | Marks the row as selected and fills it. |
TableHeader, TableFooter, TableHead, TableCell, TableCellTitle and TableCaption take the props of their native element. TableContainer is the scroll wrapper that Table renders for you.
InfiniteDataTable| Prop | Type | Default | Description |
|---|---|---|---|
rows | T[] | — | Loaded rows. |
visibleColumns | ColumnDef<T>[] | — | Columns to show. Each has `id`, `header`, `cell`, and optionally `field` and `sortable`. |
getRowId | (row: T) => string | — | Stable id of a row. |
density | "compact" | "regular" | "comfortable" | — | Same as the Table density. |
sortBy / sortDir | string | — | Sorted column field and direction (`asc` or `desc`). |
scopeKey | string | — | Changes when the result set changes. Scrolls back to the top. |
hasMore / isLoadingMore / loadMoreError | boolean | — | Paging state, owned by the caller. |
onLoadMore / onRetry / onSort | () => void | (column) => void | — | Called when the operator loads more, retries or sorts. |
onRowClick | (event, row) => void | — | Makes rows clickable. |
getRowProps | (row: T) => HTMLAttributes | — | Extra attributes per row, such as an id or a highlight. |
labels | InfiniteDataTableLabels | — | Translated copy: `sortColumn`, `loadMore`, `loading`, `retry`, `error`. |
DataTable| Prop | Type | Default | Description |
|---|---|---|---|
store | IDataTableStore<T> | — | Data source. Create it with `createDataTableStore(rows)`. Rows need an `id`, or pass `getRowId` to the store. |
columns | DataTableColumn<T>[] | — | Each column has `key`, `label` and `width` in pixels, and optionally `editable`, `flexGrow`, `renderCell`, `renderEditor` and validators. |
rowHeight | number | — | Fixed row height in pixels. |
ariaLabel / ariaLabelledBy | string | — | Accessible name of the grid. |
components | DataTableSlots<T> | — | Replaces any part of the render tree, for example the cell behavior that enables editing. |
Known issues
| Issue | Effect |
|---|---|
TableContainer always sets id="table-container". |
Duplicate ids when a page has more than one table, as on this page. Invalid HTML. |
isFetching sets bg-neutral-white opacity-40 on the whole tbody. neutral-white is 100% white in every theme. |
In Dark and Darker the body turns white while loading, and the text fades with it. |
In compact, TableCellTitle uses text-sm while other cells use text-xs. |
The title cell is larger than its neighbors. |
TableRow sets py-4 and min-h-20 on the tr. |
Padding on a table row element has no effect in table layout. The row height comes from the cells. |
TableRow always has hover:bg-secondary. |
Rows that cannot be clicked look interactive. |
DataTable uses border-border and bg-background, and cells use border-border/40. The preset has no such tokens. |
The grid falls back to the global old-border color, has no background, and the cell borders are translucent. |
InfiniteDataTable makes rows clickable with onRowClick and cursor-pointer only. |
Rows have no role, no tab stop and no key handler. Keyboard users cannot open them. |