Web · Components
DataGrid
Professional data table for large data: virtualization, multi-sort, filters, search, column resize/move/pin/hide, row and cell range selection, validated cell editing, copy/paste, undo, grouping and totals, detail rows, tree data, server mode, pagination, infinite scroll, CSV export.
Live example
Preview
Columns
Code
Events
- Events appear here when you interact with the preview.
Tree data (file explorer, folders load when opened)
Columns
Server mode (sorting, filter, search, paging on the server)
Columns
Infinite scrolling
Import
Professional data table for large data: virtualization, multi-sort, filters, search, column resize/move/pin/hide, row and cell range selection, validated cell editing, copy/paste, undo, grouping and totals, detail rows, tree data, server mode, pagination, infinite scroll, CSV export. It is a client component.
For simple, server-rendered tables Table is lighter.
- Performance: Only visible rows and columns are rendered; hundreds of thousands of rows and hundreds of columns scroll smoothly. Typing in filters and search does not stall the UI (deferred computation).
- Sorting: Click a header; Shift adds a second column (a priority number appears).
- Filter: "Filter…" from the ⋮ menu in the header: conditions by type (contains, greater than, between, empty…) or an Excel-like value list.
- Columns: Drag the edge (double-click: fit to content), drag the header to move, pin to start/end from the menu, hide/show from the "Columns" panel. The layout is stored with
storageKey. - Keyboard: Arrows, Home/End, Ctrl+Home/End, PageUp/PageDown; range selection with Shift; Ctrl+A selects all; Enter/F2 or starting to type edits, Enter/Tab saves and moves on, Esc cancels; Delete clears; Ctrl+C/V/X copies/pastes compatibly with Excel and Google Sheets; Ctrl+Z/Y undoes/redoes; Space selects the row. On a header Enter sorts, Alt+↓ opens the menu, Alt+←/→ changes width, Alt+Shift+←/→ changes order. In trees and groups ←/→ collapses/expands.
- Mobile: On touch, rows are taller, menus open from the bottom, a long press opens the context menu (copy, edit…). On a narrow screen, pinning is removed automatically if pinned columns take most of the area.
- Accessibility: ARIA
grid/treegridpattern; row/column counts, sorting, selection and expanded states are announced; result count, copy and paste are read from a live region. - RTL: Inside
dir="rtl", pinned columns, arrows and resizing flip direction.
Examples
DataGrid pagination prop: PaginationProps without total.
DataGridToolbar
interfaceParts of the DataGrid toolbar.
| Name | Type | Default | Description |
|---|---|---|---|
search? | boolean | true | Global search box. |
columns? | boolean | true | Show/hide columns panel. |
density? | boolean | true | Density picker. |
export? | boolean | true | CSV download button. |
DataGridClassNames
interfaceClasses added to the inner parts of DataGrid.
| Name | Type | Description |
|---|---|---|
toolbar? | string | Toolbar. |
viewport? | string | Scrolled area. |
header? | string | Header row. |
row? | string | Each data row. |
cell? | string | Each cell. |
footer? | string | Footer totals row. |
statusBar? | string | Status bar (record count, pagination). |
DataGridProps
interfaceProps of the DataGrid component.
| Name | Type | Default | Description |
|---|---|---|---|
columns | readonly DataGridColumn<T>[] | Columns. See DataGridColumn. | |
rows | readonly T[] | Rows. For tree data, only the root nodes. | |
rowKey? | keyof T | ((row: T) => DataGridKey) | Unique key of the row: a field name or a function. If omitted, the id field is used, or the index if that is missing too (give a key for editing and selection). | |
label? | string | Screen reader name of the table. Give it when there is no visible title. | |
title? | ReactNode | Title at the start of the toolbar. | |
actions? | ReactNode | Your own buttons appended to the end of the toolbar. | |
toolbar? | boolean | DataGridToolbar | true | Toolbar. false hides it; an object selects the parts. See DataGridToolbar. |
height? | number | string | Height (e.g. 600, "70vh", "100%"). If omitted, it grows with the content and stops at maxHeight. | |
maxHeight? | number | string | "min(70vh, 40rem)" | Maximum height when height is not given. |
density? | DataGridDensity | Row density. Fully controlled when given together with onDensityChange; given alone, it acts like an initial value (returns to it when the prop changes) and the toolbar density menu still works. | |
defaultDensity? | DataGridDensity | "standard" | Initial density. If omitted, the level closest to the UIProvider density setting is used. |
onDensityChange? | (density: DataGridDensity) => void | Called when the density changes. | |
rowHeight? | number | Row height (px); overrides density. | |
gridLines? | "horizontal" | "both" | "none" | "horizontal" | Cell borders. |
striped? | boolean | false | Alternate rows are lightly tinted. |
sort? | DataGridSort | Sorting (controlled). See DataGridSort. | |
defaultSort? | DataGridSort | Initial sorting. | |
onSortChange? | (sort: DataGridSort) => void | Called when sorting changes. | |
multiSort? | boolean | true | Sort by multiple columns with Shift. |
filters? | DataGridFilters | Filters (controlled). See DataGridFilters. | |
defaultFilters? | DataGridFilters | Initial filters. | |
onFiltersChange? | (filters: DataGridFilters) => void | Called when filters change. | |
search? | string | Global search text (controlled). | |
defaultSearch? | string | Initial search text. | |
onSearchChange? | (search: string) => void | Called when the search text changes. | |
columnState? | DataGridColumnState | Column layout (controlled). See DataGridColumnState. | |
defaultColumnState? | DataGridColumnState | Initial column layout. | |
onColumnStateChange? | (state: DataGridColumnState) => void | Called when the user changes the column layout. | |
storageKey? | string | If given, the column layout and density are stored in the browser under this name; the user's layout comes back after a page reload. | |
selection? | "none" | "single" | "multiple" | "none" | Row selection. "multiple" adds a checkbox column (range with Shift); "single" selects on row click. |
selectedKeys? | readonly DataGridKey[] | Keys of the selected rows (controlled). | |
defaultSelectedKeys? | readonly DataGridKey[] | Initially selected rows. | |
onSelectionChange? | (keys: DataGridKey[], rows: T[]) => void | Called with the keys and rows when the selection changes. | |
isRowSelectable? | (row: T) => boolean | Can the row be selected? | |
groupable? | boolean | false | Enables grouping: group by dragging headers to the grouping bar above or from the column menu. |
groupBy? | readonly string[] | Grouped columns, in order (controlled). | |
defaultGroupBy? | readonly string[] | Initially grouped columns. | |
onGroupByChange? | (groupBy: string[]) => void | Called when grouping changes. | |
getChildren? | (row: T) => readonly T[] | undefined | Tree data: the child rows of a row. If given, the grid becomes a tree table (role="treegrid"); the tree column is drawn indented with a toggle button. | |
loadChildren? | (row: T) => Promise<readonly T[]> | Loads child rows on first expand (e.g. from a server). Called for nodes where getChildren returns undefined. | |
hasChildren? | (row: T) => boolean | With loadChildren: can the node have child rows? If omitted, all can be expanded. | |
treeColumn? | string | First visible column | Column where the tree indent is drawn. |
expandedKeys? | readonly DataGridKey[] | Expanded tree nodes (controlled). | |
defaultExpandedKeys? | readonly DataGridKey[] | Initially expanded tree nodes. | |
onExpandedChange? | (keys: DataGridKey[]) => void | Called when a tree node is expanded or collapsed. | |
renderDetail? | (row: T) => ReactNode | Detail panel opened under the row. If given, a toggle column is added. | |
detailHeight? | number | 160 | Default height (px) until the detail panel is measured. |
onCellsChange? | (changes: DataGridCellChange<T>[]) => unknown | Called with the list of changes when cells are edited (typing, pasting, clearing, undo); you update the rows. If it returns a Promise the cell shows as "saving"; if it rejects, the value is reverted and the error is shown. | |
onRowClick? | (row: T, event: MouseEvent<HTMLElement>) => void | Called when a row is clicked. | |
onRowDoubleClick? | (row: T, event: MouseEvent<HTMLElement>) => void | Called when a row is double-clicked (if no cell is being edited). | |
getRowClassName? | (row: T) => string | undefined | Classes added to the row. | |
onRowReorder? | (row: T, target: T, position: "before" | "after") => void | Reorder rows by dragging: a handle column is added. On drop, called with the moved row, the target row and the position. Disabled while grouping. | |
contextMenu? | false | ((context: DataGridContextMenuContext<T>) => readonly MenuEntry[]) | Right-click (long press on touch) menu. The function returns its own items; built-in items (copy, paste, clear…) are appended below. false disables the menu. | |
mode? | "client" | "server" | "client" | Where the data is processed. "server": no sorting, filtering, search or pagination is done; changes are reported via on…Change, and you pass the rows from the server in rows. |
rowCount? | number | Total record count in server mode (pagination and status bar). | |
loading? | boolean | Loading indicator (thin bar on top; skeleton when there are no rows). | |
onLoadMore? | () => void | Infinite scroll: called when nearing the end. Give it together with hasMore. | |
hasMore? | boolean | Are there more rows to load? | |
pagination? | boolean | DataGridPagination | Pagination at the bottom. true enables it with default settings; an object takes PaginationProps settings (page size, options…). In client mode the grid paginates; in server mode give rowCount. | |
footer? | boolean | true | Footer totals row (if columns have aggregate). |
statusBar? | boolean | true | Status bar (record and selection counts). |
empty? | ReactNode | Content shown when there are no rows. | |
locale? | string | Locale used for formatting. Defaults to the UIProvider's locale. | |
currency? | string | Currency. Defaults to the UIProvider's currency. | |
exportFileName? | string | Name of the CSV file (without extension). Defaults to messages.exportFileName ("tablo"). | |
messages? | Partial<DataGridMessages> | Texts of this table; for the whole app use the ui.dataGrid namespace of the dictionary. See DataGridMessages. | |
apiRef? | Ref<DataGridApi<T>> | Functions callable from outside. See DataGridApi. | |
className? | string | Classes added to the root element. | |
classNames? | DataGridClassNames | Classes added to the inner parts. |
DataGridKey
typeRow key.
Data type of a column. Decides the filter operators, the editor, alignment, how pasted text is parsed and sorting.
"text": Text (default)."number": Number; automatic whenformatisnumber | currency | percent."date": Date (Dateor ISO string); automatic whenformatisdate | datetime."boolean": Yes/No; drawn as a checkbox."select": A value fromoptions.
DataGridColumn
interfaceDataGrid column. For shared fields see DataGridColumn in core.
Extends: Core.DataGridColumn<T, ReactNode, TooltipProp>
| Name | Type | Description |
|---|---|---|
cellClassName? | string | ((row: T, value: unknown) => string | undefined) | Classes added to the cell; with a function, based on the row and value. |
headerClassName? | string | Classes added to the header cell. |
DataGridOption
interfaceAn option of a "select" column.
| Name | Type | Description |
|---|---|---|
value | string | Value stored in the row. |
label? | string | Display name. |
Built-in aggregation functions.
Where the context menu was opened.
Aggregation of a column: shown in group rows and the summary row. A built-in name or a (values, rows) => result function.
DataGridCellContext
interfaceInfo passed to the DataGridColumn render function.
| Name | Type | Description |
|---|---|---|
row | T | Row. |
value | unknown | Raw value of the cell (value or row[key]). |
text | string | Formatted text (format applied). |
rowKey | DataGridKey | Key of the row. |
depth | number | Depth of the row in tree data (root is 0). |
DataGridEditorContext
interfaceInfo passed to the DataGridColumn editor function.
| Name | Type | Description |
|---|---|---|
row | T | Row being edited. |
value | unknown | Current value in the editor. |
onChange | (value: unknown) => void | Changes the value (does not save yet). |
commit | (value?: unknown) => void | Saves the value and leaves editing. When a value is given, it is set first. When validation fails, editing continues. |
cancel | () => void | Drops the change and leaves editing. |
error | string | null | Validation error (if any). |
typed | boolean | Editing started by pressing a letter (the value was replaced by that letter). |
inputProps | { autoFocus: true; "aria-label": string; "aria-invalid": boolean | undefined; } | Id and ARIA props to pass to the editor. |
DataGridSortItem
interfaceSorting of one column.
| Name | Type | Description |
|---|---|---|
key | string | The column's key. |
direction | "asc" | "desc" | Direction. |
DataGridSort
typeSorting: columns in priority order. Shift-clicking a header adds a second, third column.
Filter operator.
- Text:
contains,notContains,equals,notEquals,startsWith,endsWith - Number and date:
equals,notEquals,gt,gte,lt,lte,between - Select, yes/no and value list:
in - All:
empty,notEmpty
DataGridFilter
interfaceFilter of one column.
| Name | Type | Description |
|---|---|---|
operator | DataGridFilterOperator | Operator. |
value? | unknown | Value. An array of values for in; a "2026-10-30" string for dates. |
value2? | unknown | Upper bound of the between operator. |
DataGridFilters
typeFilters by column key.
DataGridColumnState
interfaceColumn layout changed by the user. Can be stored in the browser with storageKey or kept on your side with columnState.
| Name | Type | Description |
|---|---|---|
order? | readonly string[] | Order of column keys. Missing ones are appended. |
widths? | Readonly<Record<string, number>> | Widths set by hand (px). |
pinned? | Readonly<Record<string, "start" | "end" | null>> | Pins; null removes the column's own pinned. |
hidden? | Readonly<Record<string, boolean>> | Hidden columns; false removes the column's own hidden. |
DataGridDensity
typeRow density.
DataGridCellChange
interfaceA cell change.
| Name | Type | Description |
|---|---|---|
row | T | The changed row (before the change). |
rowKey | DataGridKey | Key of the row. |
key | string | The column's key. |
value | unknown | New value. |
oldValue | unknown | Old value. |
DataGridMessages
interfaceThe component's own texts; to translate into another language.
| Name | Type | Default | Description |
|---|---|---|---|
empty | string | "Kayıt yok" | |
noResults | string | "Filtreye uyan kayıt yok" | |
search | string | "Tabloda ara…" | |
columns | string | "Sütunlar" | |
density | string | "Yoğunluk" | |
compact | string | "Sıkışık" | |
standard | string | "Normal" | |
comfortable | string | "Geniş" | |
export | string | "CSV indir" | |
sortAsc | string | "Artan sırala" | |
sortDesc | string | "Azalan sırala" | |
clearSort | string | "Sıralamayı kaldır" | |
filter | string | "Filtrele…" | |
clearFilter | string | "Filtreyi kaldır" | |
clearAllFilters | string | "Tüm filtreleri kaldır" | |
pinStart | string | "Başa sabitle" | |
pinEnd | string | "Sona sabitle" | |
unpin | string | "Sabitlemeyi kaldır" | |
groupBy | string | "Bu sütuna göre grupla" | |
ungroup | string | "Gruplamayı kaldır" | |
autosize | string | "Genişliği içeriğe sığdır" | |
autosizeAll | string | "Tüm sütunları sığdır" | |
hide | string | "Sütunu gizle" | |
showAll | string | "Tümünü göster" | |
reset | string | "Sıfırla" | |
copy | string | "Kopyala" | |
copyWithHeaders | string | "Başlıklarla kopyala" | |
paste | string | "Yapıştır" | |
clear | string | "Hücreleri temizle" | |
edit | string | "Düzenle" | |
undo | string | "Geri al" | |
redo | string | "Yinele" | |
selectAll | string | "Tümünü seç" | |
selectRow | string | "Satırı seç" | |
expand | string | "Aç" | |
collapse | string | "Kapat" | |
expandAll | string | "Tümünü aç" | |
collapseAll | string | "Tümünü kapat" | |
groupBarHint | string | "Gruplamak için sütun başlığını buraya sürükleyin" | |
rows | string | "kayıt" | |
selected | string | "seçili" | |
operator | string | "Koşul" | |
value | string | "Değer" | |
from | string | "En az" | |
to | string | "En çok" | |
yes | string | "Evet" | |
no | string | "Hayır" | |
total | string | "Toplam" | |
columnMenu | string | "Sütun menüsü" | |
dragRow | string | "Satırı taşı" | |
loading | string | "Yükleniyor" | |
saving | string | "Kaydediliyor" | |
sortedAsc | string | "artan sıralandı" | |
sortedDesc | string | "azalan sıralandı" | |
copied | string | "hücre kopyalandı" | |
pasted | string | "hücre yapıştırıldı" | |
pasteSkipped | string | "hücre geçersiz olduğu için atlandı" | |
share | string | "Dışa aktar" | Export (React Native: share sheet). |
moveLeft | string | "Sola taşı" | Moves the column one to the left. |
moveRight | string | "Sağa taşı" | |
moveUp | string | "Yukarı taşı" | Moves the row one up (screen reader). |
moveDown | string | "Aşağı taşı" | |
addSort | string | "Sıralamaya ekle" | Adds the column to the sort in multi-sort. |
apply | string | "Uygula" | Confirm button of the filter panel. |
details | string | "Ayrıntı" | Row detail. |
invalidValue | string | "Geçersiz değer" | When an edited cell's value can't be read for its column type. |
exportFileName | string | "tablo" | Default name of the exported CSV file (without extension). |
operators | Record<DataGridFilterOperator, string> | Names of the filter operators. | |
aggregates | Record<DataGridAggregateName, string> | Names of the aggregation functions. |
DataGridApi
interfaceFunctions of the DataGrid callable from outside (apiRef).
| Name | Type | Description |
|---|---|---|
getVisibleRows | () => T[] | Visible (filtered, sorted) rows. Expanded tree rows included. |
getSelectedRows | () => T[] | Selected rows. |
exportCsv | (options?: { fileName?: string; rows?: "all" | "selected"; }) => void | Downloads a CSV file. rows: "selected" writes only the selected rows, "all" (default) all filtered rows (all pages). |
getCsv | (options?: { rows?: "all" | "selected"; }) => string | Returns the CSV text (without downloading). |
scrollToRow | (key: DataGridKey) => void | Scrolls a row into view and focuses it. |
startEdit | (key: DataGridKey, column: string) => void | Opens a cell for editing. |
resetColumns | () => void | Resets the column layout (order, width, pinning, visibility). |
expandAll | () => void | Expands all groups and tree nodes. |
collapseAll | () => void | Collapses all groups and tree nodes. |