The full list screen on top of Table, with no table library: give it data and columns and it owns the search, faceted filters with live counts, the sort, hidden columns, row selection, the page and the page size, each one controlled or not so a page can keep it in the URL. Rows cascade in after a sort or a page turn, a hidden column folds away while the others close the gap, Reset slides in while anything is filtered, and a bulk bar rises from the bottom centre while rows are selected.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/data-tableThis adds components/keyframery/data-table.tsx and its primitive to your project, and installs UI SDK, along with badge, button, checkbox, empty, filter, input-group, menu, pagination, select, skeleton, table, toolbar, which it builds on. The motion tokens are added to your global CSS the first time you install a component.
Usage
import { DataTable, type DataTableColumnDef } from "@/components/keyframery/data-table"
type Order = { id: string; customer: string; status: string; total: number }
const orders: Order[] = [
{ id: "1042", customer: "Maya Chen", status: "Paid", total: 184 },
{ id: "1041", customer: "Tom Okafor", status: "Pending", total: 62.5 },
]
const columns: DataTableColumnDef<Order>[] = [
{ id: "id", header: "Order", searchable: true },
{ id: "customer", header: "Customer", searchable: true },
{ id: "status", header: "Status", filter: { options: [{ value: "Paid" }, { value: "Pending" }] } },
{ id: "total", header: "Total", align: "end" },
]
export default function Usage() {
return <DataTable label="Orders" data={orders} columns={columns} />
}Examples
A list screen
Search, filters with counts, sortable headers, selection, a row menu and a bulk bar, all from data and columns.
State in your hands
Every piece of state is controlled or not: here the search, the filters, the sort and the page live in the page's own state, the way you would keep them in the URL.
Loading
loading keeps the toolbar and headers and draws skeleton rows at the table's own geometry, one per row of the page.
Motion
| Move | What you see |
|---|---|
| Cascade | After a sort or a page turn the page's rows arrive one after another, rising from below for Next and dropping from above for Previous. After a search or a filter only the rows new to the page arrive; selecting replays nothing. |
| Collapse | A hidden column folds to nothing, its text blurring out, while the other columns close the gap; a column shown again opens out of nothing. |
| Rise | The bulk bar rises from the bottom centre on a spring, from a smaller, blurred start, and sinks away when the selection is cleared. |
| Roll | The selected count, the row count and the page number roll to each new number. |
| Slide | Reset slides in beside the filters while the search or a filter is on, and folds away when they clear. |
| Draw | Row checks and the select-all dash draw themselves (from Checkbox). |
| Glide | The current page key glides along the pagination, and the highlight glides through every menu and the bulk bar. |
Timing and springiness follow the motion style you set. To change how fast this data table moves, pass speed:
<DataTable speed="fast">
…
</DataTable>"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.
Theming
Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.
| Variable | What it changes | Default |
|---|---|---|
--data-table-surface | The table's card and its sticky cells | --card |
--data-table-border | The card's hairline | black 7%; white 8% in dark |
--data-table-accent | The hover and selected row tint | --foreground |
--data-table-radius | The card's corners | 14px |
--data-table-row-height | Each row's height | 2.75rem |
--data-table-bar | The bulk bar's surface | --popover |
API reference
Every part takes className and children, along with the props of the element it renders. The parts are rendered by UI SDK, so they also take render, to draw your own element, and a function of their state for className and style.
DataTable
Renders a <div>, and takes its props too.
Prop
Type
DataTableBulkAction
Renders a <button>, and takes its props too.
Prop
Type
DataTableColumnHeader
Renders a <div>, and takes its props too.
Prop
Type
DataTableContent
Prop
Type
DataTableEmpty
Renders a <div>, and takes its props too.
Prop
Type
DataTableToolbar
Prop
Type
DataTableRoot
Renders a <div>, and takes its props too.
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
DataTableBulkBarDataTableFiltersDataTableFooter: a<div>DataTableResetDataTableSearch: a<div>DataTableView: a<div>DataTableHead: a<tableheadercell>DataTableRow: a<tr>
Hooks
useColumnPresence
Call it inside the component to read and change its state.
Prop
Type
useDataTable
Call it inside the component to read and change its state.
Prop
Type
Keyboard
| Key | What it does |
|---|---|
| Tab | Moves through the search field, the filter chips, Reset, View, the select-all, each sortable header, then each row's checkbox and menu, the bulk bar and the footer. |
| Enter | On a header, opens its menu: Asc, Desc and Hide. On a filter chip or View, opens it. |
| ArrowDown | Moves through the open menu's items; in the bulk bar, ArrowRight and ArrowLeft move between its buttons. |
| Space | Checks or unchecks the focused row's checkbox or the select-all for the page; toggles a column in View. |
| Escape | Closes an open menu; with nothing open, clears the selection while focus is in the table. |
Accessibility
Roles, keyboard and focus are declared on the component's UI SDK primitive, and state is announced through the matching ARIA attributes. More in Accessibility.
Built on UI SDK's core
UI SDK doesn't ship a data table, so this one is defined with its core: one definePrimitive in components/keyframery/core/data-table-core.ts, with no React in it. UI SDK's adapters can render that same definition in Vue, Svelte, Solid and web components. To keep your own styling and take only the motion, import from @/components/keyframery/primitives/data-table.
Questions
How does the animated Data table for UI SDK move?
Cascade: After a sort or a page turn the page's rows arrive one after another, rising from below for Next and dropping from above for Previous. After a search or a filter only the rows new to the page arrive; selecting replays nothing. Collapse: A hidden column folds to nothing, its text blurring out, while the other columns close the gap; a column shown again opens out of nothing. Rise: The bulk bar rises from the bottom centre on a spring, from a smaller, blurred start, and sinks away when the selection is cleared. Roll: The selected count, the row count and the page number roll to each new number. Slide: Reset slides in beside the filters while the search or a filter is on, and folds away when they clear. Draw: Row checks and the select-all dash draw themselves (from Checkbox). Glide: The current page key glides along the pagination, and the highlight glides through every menu and the bulk bar.
Do I need Motion or Framer Motion for the animated Data table?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
UI SDK has no data table. How is this one built on UI SDK?
Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/data-table-core.ts. Its parts are rendered by UI SDK's adapter, so they take render, state-based class names and data-slot, like every UI SDK component.
What happens to the Data table when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.
More in Data
All componentsChart
Bar, line, area and donut charts in plain SVG and CSS, no charting library: bars grow from the baseline one after another, lines draw themselves, rings sweep round, and every change of data tweens on a spring. The tooltip glides with rolling numbers, the legend folds series away, and the arrow keys walk the points.
Sparkline
A word-sized trend in plain SVG and CSS, no charting library: a line, an area or a row of bars from a list of numbers, with its last point marked. It draws itself on arrival, tweens into new data (a week into a month and back), colours itself by its news if you ask, and lets people scrub it with the pointer or the arrow keys while its value rolls in a small readout. Its trend and change are readable by screen readers and agents.