Data Grid Options

Options

Full reference of CoreUI Data Grid constructor options — columns, data, features and behavior.

Pass options to the constructor: new DataGrid(element, options). Update them later with grid.update(options).

OptionTypeDefaultDescription
autoRowHeightbooleanfalseMeasures each rendered row instead of trusting rowHeight, so rows grow with their content. Requires virtualization. See Auto row height.
cellNavigationbooleanfalseAPG grid keyboard navigation — role="grid", a roving-tabindex active cell and arrow-key movement. See Keyboard navigation.
cellSelectionbooleanfalseSpreadsheet-style cell ranges with clipboard copy; implies cellNavigation. See Cell selection.
columnsDataGridColumn[][]Column definitions — see Columns.
columnFiltersbooleanfalseRenders a filter row in the header with an input per filterable column. See Filtering.
columnMenuboolean | ((ctx) => DataGridMenuAction[])falseAdds 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. See Column menu.
columnOrderboolean | string[]falseDrag-and-drop column reordering; an array sets the initial order. Reordering never crosses a pinning boundary. See Column ordering.
columnPinningboolean | { start?: string[], end?: string[] }falseFreezes columns (by key) to the left/right edge with sticky positioning. true enables the feature with no initial pins. See Column pinning.
columnVisibilityboolean | Record<string, boolean>falseEnables hiding/showing columns via column.toggleVisibility(); an object sets the initial visibility.
columnSizingboolean | { mode?: 'onChange' | 'onEnd' }falseEnables column resize handles. mode controls whether widths update while dragging ('onChange', the default) or on release ('onEnd'). See Column sizing.
dataProvider(request) => Promise<{ items, totalRows }>nullServer-side mode: the grid requests data on every sorting/filter/page change. The request carries { sorting, columnFilters, globalFilter, pagination }. Implies pagination. See Server-side data.
editingbooleanfalseInline cell editing on Enter/F2/double-click for columns opting in via editable/editor; implies cellNavigation. See Inline editing.
emptystring | () => Node | string'No items found'Content shown when no rows match.
featuresTableFeatures | nullnullThe registered TanStack feature set; null means the entry’s default — the full dataGridFeatures in the main build, dataGridLiteFeatures in @coreui/data-grid/lite. An option whose feature is missing from the set throws at construction. See Feature sets.
globalFilterbooleanfalseRenders a search input above the grid that filters across all columns. Shorthand for toolbar: { search: true }.
historybooleanfalseUndo/redo stack over edit commits — toolbar buttons and Ctrl+Z / Ctrl+Shift+Z / Ctrl+Y. See Undo & redo.
infiniteScrollboolean | { pageSize?, threshold? }falseAppends each loaded page to the rows already in view instead of replacing them. Requires dataProvider and virtualization; cannot be combined with pagination. See Infinite scroll.
itemKey(item, index) => stringnullStable row id — required for selection to survive sorting and filtering.
itemsobject[][]Row data.
labelsPartial<DataGridLabels>{}UI strings (i18n), merged over the defaults. Supports {token} interpolation. See Localization.
overscannumber10Extra rows rendered above and below the visible window.
paginationboolean | { pageSize?, pageSizeOptions?, position?, info? }falsePagination mode — mutually exclusive with virtualization. See Pagination.
rowHeightnumber44Estimated row height in px used by the virtualizer.
printTitlestring | nullnullHeading printed above the table when print() runs. See Print.
rowHandleIconstringgrip iconCustom row drag-handle icon (SVG string).
rowOrderbooleanfalseAdds a drag handle per row for reordering; emits rowOrderChange with the reordered array. See Row reordering.
rowSelectionboolean | { selectAll? }falseCheckbox selection with select-all and shift+click ranges. See Row selection.
sanitizebooleantrueSanitize icon markup against the SVG allow list before inserting it.
sanitizeFn(html) => string | nullnullCustom sanitizer used in place of the built-in one.
slots{ toolbar?, pagination?, empty? }{}Replaces built-in chrome. Each slot is a factory ({ table, labels }) => ({ element, update?, dispose? }). See Slots.
stateKeystring | nullnullAutosaves the grid state to localStorage under this key (debounced) and restores it on init. See Save & restore state.
sortingboolean | { multiple?, resetable? }trueColumn sorting; shift+click adds columns to the sort. See Sorting.
toolbarboolean | { columns?, export?, history?, search? }falseBuilt-in toolbar above the grid. true enables every action whose feature is on; a granular object picks each. columns needs columnVisibility; export accepts a CsvDownloadOptions object; print adds the print button; history needs the history option; search is the same input as globalFilter. See Toolbar.
virtualizationbooleantrueWindowed rendering for large datasets. See Virtualization.

Every menu and header icon is overridable with its own string option (SVG markup): columnMenuIcon, sortAscendingIcon, sortDescendingIcon, sortNeutralIcon, pinStartIcon, pinEndIcon, unpinIcon, moveStartIcon, moveEndIcon, hideColumnIcon, toolbarColumnsIcon, toolbarExportIcon, toolbarUndoIcon and toolbarRedoIcon. They default to the CoreUI icon set and are sanitized like any other icon.