Overview
ARIA data grid foundation for spreadsheet-like datasets with stable row identity, explicit column widths, keyboard navigation, row selection, cell/range selection, and pinned-column metadata.
See the tabular family boundaries. DataGrid is the interactive-grid alternative to the native Table and DataTable families; choose Table for bespoke native markup or DataTable for data-shaped native tables.
Usage
Guidance
Use When
- Rendering an interactive tabular surface that needs grid semantics instead of native table semantics.
- You need built-in row selection, cell focus, range selection, and copy behavior before adding virtualization or editing.
Avoid When
- You only need a semantic read-only table — use DataTable or the Table family instead.
- You need resize handles, drag-to-reorder controls, or editing today.
When to use
- Rendering interactive tabular data that will need grid behavior such as selection, virtualization, resizing, or editing.
- You need role=grid semantics instead of native table semantics.
- You only need a semantic read-only table — use DataTable or the Table family instead.
- You need resize handles, drag-to-reorder controls, or editing today — DataGrid does not provide them yet.
Examples
Pinned order grid
A static ARIA grid with stable row ids, explicit column widths, and a pinned identifier column.
Virtualized activity log
A fixed-height DataGrid window rendering 50,000 rows and a horizontal column window with pinned edges.
Props
| Name | Type | Default | Description |
|---|---|---|---|
rows required | TRow[] | ||
columns required | DataGridColumnDef<TRow>[] | ||
getRowId required | (row: TRow) => string | Stable row identity used for ARIA ids and row-scoped state. | |
density | 'compact' | 'comfortable' | 'spacious' | 'comfortable' | Controls body row padding density. Defaults to 'comfortable'. |
stickyHeader | boolean | true | Keeps the column header row pinned to the top edge while scrolling. Defaults to true. |
virtualizeRows | boolean | false | Enables fixed-height row virtualization. |
virtualizeColumns | boolean | false | Enables LTR horizontal virtualization for unpinned columns. Pinned columns stay rendered. |
rowHeight | number | Fixed body-row pixel height used by row virtualization. Defaults to 44 when omitted or invalid. | |
columnOrder | string[] | Applies a supplied column order. | |
columnSizing | Record<string, number> | Overrides resolved column widths by column key. | |
columnPinning | {
left?: readonly string[];
right?: readonly string[];
} | Pins supplied column keys to the left or right edge. | |
selectionMode | 'none' | 'single' | 'multiple' | 'none' | Controls row-selection behavior. Cell focus and range selection remain available. |
selectionModel bindable | string[] | Controlled row-selection ids, keyed by getRowId. | |
onSelectionModelChange | (selectionModel: DataGridSelectionModel) => void | Called when row selection changes through cell interaction. | |
sortModel bindable | DataGridSortModelItem[] | [] | Controls the row sort order used to render rows. |
onSortModelChange | (sortModel: DataGridSortModel) => void | Called after the user changes sort order and DataGrid updates sortModel. | |
rowClass | text | Additional class names for body rows. | |
getRowAriaLabel | (row: TRow, rowIndex: number) => stringundefined | Optional accessible row label for screen-reader row summaries. | |
onkeydown | KeyboardEventHandler<T>undefinednull |