Skip to main content

DataGrid props

DataGrid<TRow> accepts the props below, grouped by purpose. Only rows, columns, and mode are required.

Data​

PropTypeDefaultDescription
rowsTRow[]RequiredRows to show. In server mode, the current page.
columnsColumnDef<TRow>[]RequiredColumn definitions. See ColumnDef.
mode'client' | 'server'RequiredWho processes rows. See Client vs server.
getRowId(row: TRow) => stringrow.id, then indexRow identity.

State​

PropTypeDefaultDescription
statePartial<QueryState>NoneControls the keys it includes.
initialStatePartial<QueryState>NoneStarting state, read once.
onStateChange(next: QueryState) => voidNoneCalled with the full state on every change.
onQueryChange(next: QueryState) => voidNoneCalled with the same payload as onStateChange.

Sorting​

PropTypeDefaultDescription
sortModelSortModel[]Controlled sort order.
onSortModelChange(next: SortModel) => voidNoneCalled when the sort changes.
enableMultiSortbooleanfalseSort by several columns.
sortIconsDataGridSortIconsBuilt-inCustom sort icons.
showUnsortedSortIconbooleanfalseShow an icon on unsorted columns.

Filtering​

PropTypeDefaultDescription
filterModelFilterModel{ items: [], logicOperator: 'and' }Controlled filters.
onFilterModelChange(next: FilterModel) => voidNoneCalled when filters change.
maxFiltersnumber1Most filters allowed.
filterOperatorsByTypePartial<Record<ColumnType, FilterOperator<TRow>[]>>NoneOperators per column type.
filterOperatorsByFieldRecord<string, FilterOperator<TRow>[]>NoneOperators per field.
PropTypeDefaultDescription
searchTextstring''Controlled search text.
onSearchTextChange(next: string) => voidNoneCalled when text commits.
searchDebounceMsnumber300Debounce in milliseconds.
serverSearchModeServerSearchMode'remote''remote' or 'localRows'.
serverLocalSearchTextstringNoneControlled text for localRows.
onServerLocalSearchTextChange(next: string) => voidNoneCalled when local text commits.

Column visibility​

PropTypeDefaultDescription
columnVisibilityModelColumnVisibilityModel{}Hidden columns have false.
onColumnVisibilityModelChange(next: ColumnVisibilityModel) => voidNoneCalled on change.

Pagination and loading​

PropTypeDefaultDescription
paginationModelPaginationModel{ page: 0, pageSize: 25 }Controlled page and size.
onPaginationModelChange(next: PaginationModel) => voidNoneCalled on change.
pageSizeOptionsnumber[][10, 25, 50, 100]Footer page sizes.
rowCountnumberrows.lengthTotal rows, for server mode.
loadingbooleanfalseShows the loading overlay.
loadingOverlayReactNodeBuilt-inCustom overlay.
refreshingbooleanfalsePull-to-refresh state.
onRefresh() => voidNoneEnables pull-to-refresh.
infinitebooleanfalseInfinite scroll.
onEndReached() => voidNoneRequires infinite.
onEndReachedThresholdnumber0.5Trigger distance.

Selection​

PropTypeDefaultDescription
selectionModelGridRowId[][]Controlled selection.
onSelectionModelChange(next: GridRowId[]) => voidNoneCalled on change.
checkboxSelectionbooleanfalseAdds a checkbox column.

Actions and events​

PropTypeDefaultDescription
rowActionsGridRowActionsSource<TRow>NoneRow menu items.
rowActionMenuTrigger'none' | 'longPress''longPress' with rowActionsWhat opens the menu.
onRowActionMenuOpen(params: RowActionMenuOpenParams<TRow>) => voidNoneMenu opened.
onRowPress(row: TRow) => voidNoneRow tapped.
onRowLongPress(row: TRow) => voidNoneRow long-pressed.
onRowLongPressDetails(params: RowLongPressParams<TRow>) => voidNoneLong press, with position.
onCellPress(params: CellEventParams<TRow>) => voidNoneCell tapped.
onCellLongPress(params: CellEventParams<TRow>) => voidNoneCell long-pressed.

Rendering​

PropTypeDefaultDescription
rowHeightnumber44Row height.
listMode'auto' | 'flash-list' | 'flat-list''auto'List engine. Auto uses FlashList on iOS and FlatList on Android.
drawDistancenumberFlashList defaultFlashList only. On Android it needs listMode="flash-list".
estimatedItemSizenumberNoneDeprecated and ignored. Removed in 1.0.
getRowStyle(row: TRow, index: number) => StyleProp<ViewStyle>NoneStyle per row.
zebraRowsbooleanfalseAlternate row colors.
compactbooleanfalseShorter rows.
styleStyleProp<ViewStyle>NoneContainer style.
toolbarTitleReactNodeNoneContent at the start of the toolbar.
testIDstringNoneTest identifier for the container.

Appearance and text​

PropTypeDefaultDescription
themeDataGridThemeLight themeTheme overrides.
localeDataGridLocale'en''en' or 'pt'.
localeTextPartial<DataGridLocaleText>NoneText overrides.
emptyLabelstringLocale textEmpty message.
emptyStateReactNodeBuilt-inCustom empty state.