Skip to main content

Column options

Columns are standard TanStack ColumnDefs (accessorKey, id, header, cell, size, minSize, maxSize, enableSorting, enableResizing, …). The grid adds the 19 options below. Import ColumnDef from the grid so these options are typed:

import type { ColumnDef } from '@ackplus/mui-tanstack-data-grid';

const columns: ColumnDef<User, any>[] = [
{ accessorKey: 'age', header: 'Age', type: 'number', align: 'right', aggregation: 'avg' },
];
OptionTypeDescription
type'boolean' | 'number' | 'date' | 'select' | 'text'Data type — drives default filter operators/inputs.
options{ label: string; value: string }[]Options for type: 'select' columns.
align'left' | 'center' | 'right'Cell + header text alignment.
valueGetter(params: { row: TData }) => anyDerive the column's value from the row when there's no plain accessorKey (e.g. a computed/combined field). Feeds sorting, filtering, and export — so the whole grid agrees on one value.
valueFormatter(params: { value: any; row: TData }) => anyFormat the value for display only (the cell). Sorting/filtering/export keep using the raw value. Ignored if the column defines its own cell.
aggregation'sum' | 'avg' | 'min' | 'max' | 'count' | ((rows: TData[]) => any)Footer aggregation for this column (needs enableAggregation). A built-in reducer ('sum' | 'avg' | 'min' | 'max' | 'count') over the filtered rows, or a function receiving the filtered row data. Client-mode only.
filterablebooleanMark the column as filterable in the column-filter UI.
disableColumnMenubooleanHide the per-column header ⋮ menu for just this column (needs enableColumnMenu).
wrapTextbooleanWrap cell text instead of truncating with an ellipsis (default: false).
editableboolean | ((row: TData) => boolean)Allow inline editing of this column's cells (needs a processRowUpdate or local data).
disableRowClickbooleanClicks anywhere in this column's cells never trigger the row click (onRowClick / selectOnRowClick). Use it for a cell that holds its own control (a dropdown, a switch, a link): a near-miss beside the control then does nothing instead of, say, opening the row. Clicks from a menu the cell portals are covered too. On by default for the built-in selection, expand, and actions columns.
cellClassNamestring | ((context: { value: any; row: TData }) => string)Conditional class for body cells (DataGrid-style).
headerClassNamestringConditional class for the header cell.
hideInExportbooleanLeave this column out of every export (CSV, Excel, server).
exportHeaderstring | ((context: { columnId: string; defaultHeader: string; columnDef: DataTableColumnOptions<TData, TValue> & Record<string, any> }) => string)The column's header in exported files (default: its header).
exportValue(context: ColumnExportContext<TData, TValue>) => anyTransform the raw value before it's formatted for export.
exportFormat'auto' | 'string' | 'number' | 'boolean' | 'json' | 'date' | ((context: ColumnExportContext<TData, TValue>) => any)How the value is written to the file — a fixed format, or a function returning the value.
editComponentComponentType<DataTableEditComponentProps<TData, TValue>>A custom inline editor for this column's cells (needs editable).
filterComponentComponentType<ColumnInputProps<TData, TValue>>A custom value input for this column in the filter panel.