The table that runs your data
Table draws rows, and this one runs them: typed columns, sorting by one column or several, filters, search, selection, paging, editing in place, grouping with totals, row details, saved views, thousands of rows and rows that live on a server. Every part is opt in, so the smallest form is a table with sortable headers, and a TableToolbar in its toolbar slot drives it with no props.
A working table
Typed columns, the control bar, selection and paging together. Add a filter, sort by a header (Shift-click adds a second sort), tick a few rows and the bar becomes the bulk bar.
Tags | Site | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | Yes | ||||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | No | ||||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | Yes | ||||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | Yes | ||||
Litware | Lost | Alex Morgan | $35,676 | 153 | 92% | No |
Column types
A column's type sets its cell, its alignment, its sort, its filter conditions and its editor, with no render function: text, status, person, currency and number, progress, date, tags, checkbox and link. Format carries the locale, the currency and the date style, and a render function still wins over the type.
Tags | Site | ||||||||
|---|---|---|---|---|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | Yes | |||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | No | |||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | Yes | |||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | Yes |
Columns
Drag a header's edge to resize it, or double-click it to fit. Drag a header to move it. Each header's menu sorts, pins, moves, hides and filters, and Alt+Down opens it from the keyboard. Account is pinned to the start, so the rest scroll under it.
Tags | Site | ||||||||
|---|---|---|---|---|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | Yes | |||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | No | |||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | Yes | |||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | Yes |
Editing
An editable column opens the editor its type brings. Double-click a cell, or focus it and press Enter or start typing; Enter saves and moves down, Tab saves and moves on, Escape cancels. Row editing opens a whole row with Save and Cancel. A checkbox stays live and saves as it is ticked.
Northwind | Lead | Priya Shah | $4,000 | ||
|---|---|---|---|---|---|
Fabrikam | Trial | Sam Rivera | $11,919 | ||
Contoso | Proposal | Jordan Lee | $19,838 | ||
Tailspin | Won | Lee Chen | $27,757 |
Groups and totals
Grouped by stage, in the stage's own order. Each group row carries its count and each column's aggregate, its chevron folds it and its checkbox selects the group. The footer's cells each pick a calculation over every matching row.
$130,785 | 570 | 14% | ||||
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | |
Adatum | Lead | Priya Shah | $43,595 | 190 | 14% | |
Contoso 2 | Lead | Priya Shah | $83,190 | 375 | 28% | |
$154,542 | 681 | 37% | ||||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | |
Proseware | Trial | Sam Rivera | $51,514 | 227 | 37% | |
Tailspin 2 | Trial | Sam Rivera | $91,109 | 412 | 51% | |
$79,271 | 343 | 53% | ||||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | |
Woodgrove | Proposal | Jordan Lee | $59,433 | 264 | 60% | |
$95,109 | 417 | 76% | ||||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | |
Northwind 2 | Won | Lee Chen | $67,352 | 301 | 83% | |
$110,947 | 491 | 49% | ||||
Litware | Lost | Alex Morgan | $35,676 | 153 | 92% | |
Fabrikam 2 | Lost | Alex Morgan | $75,271 | 338 | 5% | |
Row details
renderDetail adds a chevron column, and an opened row shows its details beneath it, across the table, rendered only once opened.
| Details | ||||
|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | |
Northwind has 5 seats and is 0% onboarded. Its tags are enterprise, upsell. | ||||
Fabrikam | Trial | Sam Rivera | $11,919 | |
Contoso | Proposal | Jordan Lee | $19,838 | |
Tailspin | Won | Lee Chen | $27,757 | |
AI command
Press Describe in the bar and type what you want to see. The row turns into a composer, your handler turns the sentence into a whole view, and a toast reports the change with an Undo. The library calls no model; this demo's handler is a stand-in you can try for free. The merchant sales template runs it on a real model.
Tags | Site | ||||||||
|---|---|---|---|---|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | Yes | |||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | No | |||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | Yes | |||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | Yes | |||
Litware | Lost | Alex Morgan | $35,676 | 153 | 92% | No |
Saved views
A view is the table's setup as one object: sorts, filters, search, columns, grouping and density. Pick a tab and the table takes its setup; change anything and the tab shows a dot, and its menu saves, resets, renames or deletes it.
A view can also hold a list on a text column, which no filter menu offers: an id that is any of the rows a reader ticked, or the ten customers a model picked. It is how a host shows these rows, and how the merchant sales template turns the table to the orders a confirmed change touched. Its chip opens to the values it holds, each one a tick that can be let go and taken back.
Tags | Site | ||||||||
|---|---|---|---|---|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | Yes | |||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | No | |||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | Yes | |||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | Yes | |||
Litware | Lost | Alex Morgan | $35,676 | 153 | 92% | No | |||
Adatum | Lead | Priya Shah | $43,595 | 190 | 14% | Yes | |||
Proseware | Trial | Sam Rivera | $51,514 | 227 | 37% | Yes | |||
Woodgrove | Proposal | Jordan Lee | $59,433 | 264 | 60% | No | |||
Northwind 2 | Won | Lee Chen | $67,352 | 301 | 83% | Yes | |||
Fabrikam 2 | Lost | Alex Morgan | $75,271 | 338 | 5% | Yes | |||
Contoso 2 | Lead | Priya Shah | $83,190 | 375 | 28% | No | |||
Tailspin 2 | Trial | Sam Rivera | $91,109 | 412 | 51% | Yes |
Thousands of rows
Past two hundred unpaged rows the table draws only the rows in view, so five thousand scroll, sort and filter as quickly as ten. With hasMore it asks for the next batch as the end comes into view.
Tags | Site | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
Northwind | Lead | Priya Shah | $4,000 | 5 | 0% | Yes | ||||
Fabrikam | Trial | Sam Rivera | $11,919 | 42 | 23% | No | ||||
Contoso | Proposal | Jordan Lee | $19,838 | 79 | 46% | Yes | ||||
Tailspin | Won | Lee Chen | $27,757 | 116 | 69% | Yes | ||||
Litware | Lost | Alex Morgan | $35,676 | 153 | 92% | No | ||||
Adatum | Lead | Priya Shah | $43,595 | 190 | 14% | Yes | ||||
Proseware | Trial | Sam Rivera | $51,514 | 227 | 37% | Yes | ||||
Woodgrove | Proposal | Jordan Lee | $59,433 | 264 | 60% | No | ||||
Northwind 2 | Won | Lee Chen | $67,352 | 301 | 83% | Yes | ||||
Fabrikam 2 | Lost | Alex Morgan | $75,271 | 338 | 5% | Yes | ||||
Contoso 2 | Lead | Priya Shah | $83,190 | 375 | 28% | No | ||||
Tailspin 2 | Trial | Sam Rivera | $91,109 | 412 | 51% | Yes | ||||
Litware 2 | Proposal | Jordan Lee | $7,028 | 449 | 74% | Yes | ||||
Adatum 2 | Won | Lee Chen | $14,947 | 6 | 97% | No | ||||
Proseware 2 | Lost | Alex Morgan | $22,866 | 43 | 19% | Yes | ||||
Woodgrove 2 | Lead | Priya Shah | $30,785 | 80 | 42% | Yes | ||||
Northwind 3 | Trial | Sam Rivera | $38,704 | 117 | 65% | No |
On a phone
Narrower than a phone, measured on the table itself, Scroll keeps the rows and pins the row header while the rest scroll sideways, and Stack draws each row as a card.
Northwind | Lead | Priya Shah | $4,000 | ||
|---|---|---|---|---|---|
Fabrikam | Trial | Sam Rivera | $11,919 | ||
Contoso | Proposal | Jordan Lee | $19,838 |
Rows on a server
In manual mode the table leaves sorting, filtering, search and paging to your server: it reports what the reader asks for and shows the page it is given, with rowCount driving the pager. A refetch keeps the rows on screen, dimmed under a thin line.
Northwind | Lead | Priya Shah | $4,000 |
|---|---|---|---|
Fabrikam | Trial | Sam Rivera | $11,919 |
Contoso | Proposal | Jordan Lee | $19,838 |
Tailspin | Won | Lee Chen | $27,757 |
Litware | Lost | Alex Morgan | $35,676 |
Loading
While the first rows are on their way, loading draws skeleton rows under the real header, each a text line tall, so the rows that replace them do not jump.
Failed load
An error with nothing on screen takes the table's body, with Try again calling onRetry. A failed fetch over rows already shown keeps them, with the error in a banner above.
Couldn't load the rows
The server took too long to answer.
Northwind | Lead | Priya Shah | $4,000 |
|---|---|---|---|
Fabrikam | Trial | Sam Rivera | $11,919 |
Empty
No rows renders the bordered empty state instead of a bare table. Replace it through emptyState, or its words through emptyStateLabels.
No matching rows
Adjust the search or filters and try again.
// From the npm package
import { DataTable } from 'rift-ds/components/DataTable/DataTable';
// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/data-table.json