React Data Grid Options

Options

Full reference of CDataGrid props — columns, data, features and behavior of the React Data Grid.

On this page

Pass props to the component: <CDataGrid columns={columns} items={items} />. There is no imperative update call — change a prop and the grid re-renders.

CDataGrid

jsx
import { CDataGrid } from '@coreui/react-data-grid'
PropertyDefaultType
autoRowHeight-boolean, undefined

Measures each rendered row instead of trusting rowHeight, so rows grow with their content (wrapping cells, custom renderers). rowHeight stays the estimate for rows that have not been rendered yet. Requires virtualization.

cellNavigation-boolean, undefined

APG grid keyboard navigation — role="grid", a roving-tabindex active cell, and arrow-key movement across header and data cells.

cellSelection-boolean, undefined

Spreadsheet-style cell ranges — shift-click, drag and shift+arrows, with Ctrl/Cmd+C copying the range as TSV and Ctrl/Cmd+A selecting everything. Implies cellNavigation.

columnFilters-boolean, undefined

Renders a filter row in the header with an input per filterable column.

columnMenu-boolean, CDataGridColumnMenuBuilder, undefined

Adds a per-column header menu — true builds it from the enabled features (sort/pin/move/hide); a builder ({ column, defaultActions }) => actions returns the final item list.

columnMenuIcon-ReactNode

Custom column menu button icon (ReactNode) replacing the default one.

columnOrder-boolean, ColumnOrderState, undefined

Enables drag-and-drop column reordering; an array sets the initial order.

columnPinning-boolean, Partial<ColumnPinningState>, undefined

Freezes columns (by key) to the start/end edge with sticky positioning; true enables the feature with no initial pins.

columns-CDataGridColumn<TFeatures>[]

Column definitions.

columnSizing-boolean, DataGridColumnSizingOptions, undefined

Enables column resize handles; mode controls whether widths update while dragging ('onChange', the default) or on release ('onEnd').

columnVisibility-boolean, ColumnVisibilityState, undefined

Enables hiding/showing columns via column.toggleVisibility(); an object sets the initial visibility.

dataProvider-((request: DataGridDataRequest) => Promise<DataGridDataResponse>), undefined

Server-side mode: the grid requests data on every sorting/filter/page change; implies pagination.

editing-boolean, undefined

Inline cell editing on Enter/F2/double-click for columns opting in via editable/editor; implies cellNavigation.

empty-ReactNode

Content (ReactNode) shown when no rows match.

features-TableFeatures, undefined

The registered TanStack feature set — pass dataGridLiteFeatures (or a custom tableFeatures({...}) set) so the app bundle only carries the features it uses; defaults to the full dataGridFeatures.

filterIcon-ReactNode

Icon for the per-column filter button.

globalFilter-boolean, undefined

Renders a search input above the grid that filters across all columns.

hideColumnIcon-ReactNode

Custom hide-column menu action icon (ReactNode) replacing the default one.

history-boolean, undefined

Undo/redo history of edit commits — Ctrl/Cmd+Z and Ctrl+Shift+Z/Ctrl+Y plus toolbar buttons; requires editing.

infiniteScroll-boolean, DataGridInfiniteScrollOptions, undefined

Appends each loaded page to the rows already in view instead of replacing them; requires dataProvider and virtualization, cannot be combined with pagination.

itemKey-((item: DataGridItem, index: number) => string), undefined

Stable row id — required for selection to survive sorting and filtering.

items-DataGridItem[], undefined

Row data.

labels-Partial<DataGridLabels>, undefined

UI strings (i18n), merged over the defaults; supports {token} interpolation.

moveEndIcon-ReactNode

Custom move-right menu action icon (ReactNode) replacing the default one.

moveStartIcon-ReactNode

Custom move-left menu action icon (ReactNode) replacing the default one.

onCellCopy-((event: { text: string; }) => void), undefined

Fires after Ctrl/Cmd+C copies a cell selection, with the text written to the clipboard.

onDataError-((error: unknown) => void), undefined

Fires when the data provider rejects, with the error (server-side mode).

onDataLoad-((response: DataGridDataResponse) => void), undefined

Fires when the data provider resolves, with the { items, totalRows } response (server-side mode).

onEditCancel-((item: DataGridItem, columnId: string) => void), undefined

Fires when an edit is cancelled, with the item and column key.

onEditCommit-((event: DataGridEditCommitEvent) => void), undefined

Fires when an edit commits, with { item, columnId, value, previousValue } — the grid never mutates items; apply the change and re-render.

onEditStart-((item: DataGridItem, columnId: string) => void), undefined

Fires when a cell enters edit mode, with the item and column key.

onFilterChange-((columnFilters: ColumnFiltersState, globalFilter: string) => void), undefined

Fires when column filters or the global filter change, with both filter states.

onOrderChange-((columnOrder: ColumnOrderState) => void), undefined

Fires when columns are reordered, with the TanStack columnOrder state.

onPaginationChange-((pagination: PaginationState) => void), undefined

Fires when the page or page size changes, with the TanStack pagination state.

onPinningChange-((columnPinning: ColumnPinningState) => void), undefined

Fires when column pinning changes, with the TanStack columnPinning state.

onRowOrderChange-((event: CDataGridRowOrderEvent) => void), undefined

-

onSelectionChange-((rowSelection: RowSelectionState, selectedItems: DataGridItem[]) => void), undefined

Fires when the row selection changes, with the TanStack rowSelection state and the selected items.

onSizingChange-((columnSizing: ColumnSizingState) => void), undefined

-

onSortingChange-((sorting: SortingState) => void), undefined

Fires when sorting changes, with the TanStack sorting state.

onVisibilityChange-((columnVisibility: ColumnVisibilityState) => void), undefined

Fires when column visibility changes, with the TanStack columnVisibility state.

overscan-number, undefined

Extra rows rendered above and below the visible window.

pagination-boolean, DataGridPaginationOptions, undefined

Pagination mode — mutually exclusive with virtualization.

pinEndIcon-ReactNode

Custom pin-right menu action icon (ReactNode) replacing the default one.

pinStartIcon-ReactNode

Custom pin-left menu action icon (ReactNode) replacing the default one.

printTitle-string, undefined

Heading printed above the table when the print action runs; omitted when unset.

ref-Ref<HTMLDivElement>, undefined

-

rowHandleIcon-ReactNode

Custom row drag-handle icon (ReactNode) replacing the default grip.

rowHeight-number, undefined

Estimated row height in px used by the virtualizer.

rowOrder-boolean, undefined

Adds a drag handle per row for reordering; the grid emits onRowOrderChange with the reordered array instead of mutating items.

rowSelection-boolean, DataGridRowSelectionOptions, undefined

Checkbox selection with select-all and shift+click ranges.

slots-Partial<CDataGridSlots<TFeatures>>, undefined

Replaces built-in chrome — each slot is a component rendered with { table, labels }.

sortAscendingIcon-ReactNode

Custom ascending sort indicator icon (ReactNode) replacing the default one.

sortDescendingIcon-ReactNode

Custom descending sort indicator icon (ReactNode) replacing the default one.

sorterVisibility-'always', 'hover', undefined

Controls when the neutral (unsorted) sort icon is shown on sortable columns: 'always' keeps it visible, 'hover' reveals it on header hover/focus. Omit to hide it until the column is sorted.

sorting-boolean, DataGridSortingOptions, undefined

Column sorting; shift+click adds columns to the sort.

sortNeutralIcon-ReactNode

Custom unsorted sort indicator icon (ReactNode) replacing the default one.

stateKey-string, undefined

Persists the grid state (sorting, filters, order, sizing, visibility, pinning, selection, page) to localStorage under this key — autosaved on every change and restored on mount.

tableRef-Ref<CDataGridTable<TFeatures>>, undefined

Ref that receives the TanStack table instance.

toolbar-boolean, CDataGridToolbarOptions, undefined

Adds a built-in toolbar above the grid — true enables every action whose feature is on (column chooser, CSV export, global search); an object picks each individually.

toolbarColumnsIcon-ReactNode

Custom toolbar column-chooser button icon (ReactNode) replacing the default one.

toolbarExportIcon-ReactNode

Custom toolbar export button icon (ReactNode) replacing the default one.

toolbarPrintIcon-ReactNode

Icon for the toolbar's print button.

toolbarRedoIcon-ReactNode

Custom toolbar redo button icon (ReactNode) replacing the default one.

toolbarUndoIcon-ReactNode

Custom toolbar undo button icon (ReactNode) replacing the default one.

unpinIcon-ReactNode

Custom unpin menu action icon (ReactNode) replacing the default one.

virtualization-boolean, undefined

Windowed rendering for large datasets.