DataGrid

Markdown

A table with sorting, paging, row selection and column toggles.

Used in SaaS admin, Evaluations, Analytics and 1 more patterns.

Use it for
Large tables with controlled sorting, paging, selection and column visibility.
Not for
A few read-only rows. Try Table.

DataGrid preview

Loading example…

Installation

npm install @stackunseen/ui
import { DataGrid } from '@stackunseen/ui/application';
Styles: @stackunseen/ui/styles.css and @stackunseen/ui/application.css

Usage and props

Import this component from @stackunseen/ui/application. Load @stackunseen/ui/styles.css first, then @stackunseen/ui/application.css.

Pass the rows for the current page. The grid requests sorting, filtering, paging and selection changes; your application updates the data and controlled props. Selecting a row never grants permission to act on it.

captionstring
The native table caption and scroll-region name.
captionVisibility'visible' | 'hidden' (optional)
Hide the caption on screen when a surrounding card already shows the same heading; screen readers still announce it.
columnsreadonly DataGridColumn<Row>[]
Stable column IDs, headers and trusted React cell renderers. Use rowHeader for the record name.
rowsreadonly Row[]
The current page of rows, already filtered, sorted and paged by your app. The grid never fetches or changes them.
getRowId(row: Row) => string
A unique, nonblank ID used for selection and focus recovery.
sortDataGridSort | null (optional)
Current column and direction. onSortChange cycles ascending, descending and unsorted.
paginationDataGridPagination (optional)
Zero-based pageIndex, pageSize and totalRows. For an unknown total, supply hasNextPage.
selectedRowIdsreadonly string[] (optional)
Selected IDs across pages. The header checkbox changes only selectable rows on the current page.
onSelectionChange(ids: readonly string[]) => void (optional)
Requests the full updated selection, preserving IDs outside this page.
columnVisibilityReadonly<Record<string, boolean>> (optional)
Visible columns by ID. onColumnVisibilityChange requests the updated map.
filterDataGridFilter (optional)
Controlled value, accessible label and onValueChange callback for search.
How state and callbacks work
All props

Loading…

For your coding agent

Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.

Contract
caption · captionVisibility? · columns · rows · getRowId · sort? · pagination? · selectedRowIds?
Keeps honest
Selecting a row never grants permission to act on it.
MCP
read_component "DataGrid" on the docs endpoint
Open the Markdown file

Keyboard and customization

Keyboard

Tab reaches sort buttons, selection, column controls and paging. Wide tables scroll within their labeled region.

Customization

Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio