DataGrid
The workhorse table for ERP / admin surfaces — Table plus a toolbar, filtering, saved views, column management, frozen columns and inline editing.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
- Use it when Dense, interactive tabular data: sorting, filtering, saved views, selection, inline edit.
- Reach for something else when A simple read-only list — use
Table.
Accessibility
Semantic table with column headers, aria-sort on sortable columns, keyboard-reachable filters, selection and inline edit.
Install and import
npx shadcn@latest add @prism/data-grid
import { DataGrid } from '@/components/prism/DataGrid';
In a no-build prototype, read it from the bundle instead: const { DataGrid } = window.PrismDesignSystem_39d121;
Examples
Saved views + selection
<DataGrid columns={columns} rows={rows} getRowKey={(r) => r.id}
isSelectable views={views} maxHeight={420} onCellEdit={save} />
Status cell renderer
{ key: "status", header: "Status",
render: (r) => <Badge tone={toneFor(r.status)}>{r.status}</Badge> }
Props
| Prop | Type | Required | Description |
|---|---|---|---|
columns | DataGridColumn<Row>[] | Yes | |
rows | Row[] | Yes | |
getRowKey | (row: Row, index: number) => React.Key | — | |
density | "comfortable" | "compact" | — | |
isSelectable | boolean | — | |
isSearchable | boolean | — | Show the built-in global search box. Default true. Set false when the grid sits under a page-level search so two inputs do not narrow one list. |
views | DataGridView[] | — | Named presets shown in the Saved views menu. |
onCellEdit | (rowKey: React.Key, columnKey: string, value: string) => void | — | |
onRowAction | (row: Row) => void | — | |
maxHeight | number | — | Max body height before the grid scrolls (px). Default 460. |
emptyState | React.ReactNode | — | Custom node rendered when no rows match. |
groupBy | string | null | — | Initial grouping column key. |
groupableColumns | string[] | — | Column keys offered in the Group menu. Omit to hide the menu. |
aggregates | Record<string, DataGridAggregate<Row>> | null | — | Per-column aggregation, shown in a sticky footer row and in each group header. |
bulkActions | DataGridBulkAction<Row>[] | — | Actions shown in the floating bar while rows are selected. |
className | string | — |