React Native · Components
DataGrid
Data grid: sorting, filters, search, grouping, trees, detail rows, editing, selection, pinned columns, pagination and infinite scroll.
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
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
DataGrid
componentData grid: sorting, filters, search, grouping, trees, detail rows, editing, selection, pinned columns, pagination and infinite scroll. Same API and the same data processing core as DataGrid on web; adapted for phones:
- Rows are in a virtual list (smooth with thousands of rows); columns scroll horizontally, pinned columns stay in place with the native driver.
- Tapping a header sorts; the header menu has sort, filter, pin, move, group and hide. Dragging its right edge changes the width.
- Tapping an editable cell opens the editor in a bottom sheet; a yes/no cell toggles directly. Undo/redo is in the toolbar.
- Long-pressing a row opens the menu (
contextMenu) or selects in multiple selection. Export sends the CSV via the share sheet. - Looks the same on iOS and Android.
Examples
DataGridToolbar
interfaceParts of the toolbar.
| Name | Type | Default | Description |
|---|---|---|---|
search? | boolean | true | Search box. |
columns? | boolean | true | The "Columns" panel. |
density? | boolean | true | Density menu. |
export? | boolean | true | Export (CSV, via the share sheet). |
DataGridPagination
interfacePagination settings.
| Name | Type | Default | Description |
|---|---|---|---|
page? | number | Page in controlled use (starts at 1). | |
defaultPage? | number | 1 | First page in uncontrolled use. |
onPageChange? | (page: number) => void | Called when the page changes. | |
pageSize? | number | Page size in controlled use. | |
defaultPageSize? | number | 50 | Page size in uncontrolled use. |
onPageSizeChange? | (size: number) => void | Called when the page size changes. | |
pageSizeOptions? | readonly number[] | Page size options (the first value becomes the default). |
DataGridStyles
interfaceStyles of the inner parts of DataGrid.
| Name | Type | Description |
|---|---|---|
toolbar? | ViewStyle | Toolbar. |
header? | ViewStyle | Header row. |
row? | ViewStyle | Data row. |
cell? | TextStyle | Cell text. |
footer? | ViewStyle | Footer total row. |
DataGridProps
interfaceProps of the DataGrid component (same names as on web).
| 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 a row: a field name or a function. If omitted the id field is used, or the index if that is missing (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 to add at the end of the toolbar. | |
toolbar? | boolean | DataGridToolbar | true | Toolbar. false hides it; an object picks the parts. |
density? | DataGridDensity | Density in controlled use. | |
defaultDensity? | DataGridDensity | "standard" | Initial density in uncontrolled use. |
onDensityChange? | (density: DataGridDensity) => void | Called when the density changes. | |
rowHeight? | number | Row height (dp); overrides the density. Densities are taller than on web so rows are comfortable to tap: 40, 48, 56. | |
gridLines? | "horizontal" | "both" | "none" | "horizontal" | Cell lines. |
striped? | boolean | false | Alternating row colors. |
sort? | DataGridSort | Sorting in controlled use. | |
defaultSort? | DataGridSort | Initial sorting in uncontrolled use. | |
onSortChange? | (sort: DataGridSort) => void | Called when the sorting changes. | |
multiSort? | boolean | true | Sorting by multiple columns ("Add to sort" in the column menu). |
filters? | DataGridFilters | Filters in controlled use. | |
defaultFilters? | DataGridFilters | Initial filters in uncontrolled use. | |
onFiltersChange? | (filters: DataGridFilters) => void | Called when the filters change. | |
search? | string | Global search in controlled use. | |
defaultSearch? | string | Initial search in uncontrolled use. | |
onSearchChange? | (search: string) => void | Called when the search changes. | |
columnState? | DataGridColumnState | Column layout in controlled use. See DataGridColumnState. | |
defaultColumnState? | DataGridColumnState | Initial column layout in uncontrolled use. | |
onColumnStateChange? | (state: DataGridColumnState) => void | Called when the column layout changes. | |
storageKey? | string | When given, the column layout and density are stored in storage under this name; the user's layout comes back when the app is reopened. | |
storage? | PreferenceStorage | Storage for storageKey (e.g. @yasinsensoy/native/storage). Defaults to memory. | |
selection? | "none" | "single" | "multiple" | "none" | Row selection. "multiple" adds a checkbox column (long-pressing a row also selects); "single" selects when a row is tapped. |
selectedKeys? | readonly DataGridKey[] | Selected keys in controlled use. | |
defaultSelectedKeys? | readonly DataGridKey[] | Initially selected keys in uncontrolled use. | |
onSelectionChange? | (keys: DataGridKey[], rows: T[]) => void | Called with the keys and rows when the selection changes. | |
isRowSelectable? | (row: T) => boolean | Whether a row can be selected. | |
groupable? | boolean | false | Enables grouping from the column menu. |
groupBy? | readonly string[] | Grouping columns in controlled use. | |
defaultGroupBy? | readonly string[] | Initial grouping in uncontrolled use. | |
onGroupByChange? | (groupBy: string[]) => void | Called when the grouping changes. | |
getChildren? | (row: T) => readonly T[] | undefined | Tree data: the child rows of a row. | |
loadChildren? | (row: T) => Promise<readonly T[]> | Loads child rows on first expand (e.g. from the server). | |
hasChildren? | (row: T) => boolean | With loadChildren: can the node have child rows? If omitted all can expand. | |
treeColumn? | string | The first visible column | Column the tree indentation is drawn in. |
expandedKeys? | readonly DataGridKey[] | Expanded tree nodes in controlled use. | |
defaultExpandedKeys? | readonly DataGridKey[] | Initially expanded nodes in uncontrolled use. | |
onExpandedChange? | (keys: DataGridKey[]) => void | Called when the expanded nodes change. | |
renderDetail? | (row: T) => ReactNode | Detail panel that opens below a row. When given an expand/collapse column is added. | |
detailHeight? | number | 160 | Height of the detail panel before it is measured (dp). |
onCellsChange? | (changes: DataGridCellChange<T>[]) => unknown | Called with the list of changes when a cell is edited (an editor opens on tap; yes/no toggles directly); you update the rows. If it returns a Promise the cell shows "saving", and an error is shown if it rejects. | |
onRowClick? | (row: T) => void | Called when a row is tapped. | |
getRowStyle? | (row: T) => ViewStyle | undefined | Style to add to a row's container. | |
onRowReorder? | (row: T, target: T, position: "before" | "after") => void | Reordering rows by long-pressing and dragging the handle. On release it is called with the moved row, the target row and the position. Disabled while grouping. | |
contextMenu? | false | ((context: DataGridContextMenuContext<T>) => readonly MenuEntry[]) | Menu that opens when a row is long-pressed. false turns it off. | |
mode? | "client" | "server" | "client" | "server": no filtering, searching, sorting or paging 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. | |
loading? | boolean | Loading indicator (a thin bar on top; a skeleton when there are no rows). | |
onLoadMore? | () => void | Infinite scroll: called when nearing the end. Give it together with hasMore. | |
hasMore? | boolean | Whether there are more rows. | |
pagination? | boolean | DataGridPagination | Pagination. true enables it with default settings. See DataGridPagination. | |
footer? | boolean | true | Footer total row (when columns have aggregate). |
statusBar? | boolean | true | Status bar (record and selection count). |
empty? | ReactNode | Content shown when there are no rows. | |
locale? | string | Language used for formatting. Defaults to the UIProvider language. | |
currency? | string | Currency. Defaults to the UIProvider currency. | |
exportFileName? | string | Name of the exported file (without extension). Defaults to the exportFileName text ("tablo" in Turkish). | |
messages? | Partial<DataGridMessages> | Texts. If omitted, Turkish or English depending on the language. | |
apiRef? | Ref<DataGridApi<T>> | Functions that can be called from outside. See DataGridApi. | |
style? | StyleProp<ViewStyle> | Root style; the height comes from here (or from the container's flex). | |
styles? | DataGridStyles | Styles of the inner parts. | |
testID? | string | Test id. |
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.
DataGridOption
interfaceAn option of a "select" column.
| Name | Type | Description |
|---|---|---|
value | string | Value stored in the row. |
label? | string | Display name. |
DataGridColumn
interfaceA DataGrid column (same fields as on web). Instead of the classes on web there are cellStyle and headerStyle.
Extends: Core.DataGridColumn<T, ReactNode, TooltipProp>
| Name | Type | Description |
|---|---|---|
cellStyle? | TextStyle | ((row: T, value: unknown) => TextStyle | undefined) | Style of the cell text; when a function, based on the row and value. |
headerStyle? | TextStyle | Style of the header text. |
Built-in aggregation functions.
Aggregation of a column: shown in group rows and the summary row. A built-in name or a (values, rows) => result function.
Information for the menu opened by a long press.
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. |