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' },
];
| Option | Type | Description |
|---|---|---|
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 }) => any | Derive 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 }) => any | Format 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. |
filterable | boolean | Mark the column as filterable in the column-filter UI. |
disableColumnMenu | boolean | Hide the per-column header ⋮ menu for just this column (needs enableColumnMenu). |
wrapText | boolean | Wrap cell text instead of truncating with an ellipsis (default: false). |
editable | boolean | ((row: TData) => boolean) | Allow inline editing of this column's cells (needs a processRowUpdate or local data). |
disableRowClick | boolean | Clicks 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. |
cellClassName | string | ((context: { value: any; row: TData }) => string) | Conditional class for body cells (DataGrid-style). |
headerClassName | string | Conditional class for the header cell. |
hideInExport | boolean | Leave this column out of every export (CSV, Excel, server). |
exportHeader | string | ((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>) => any | Transform 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. |
editComponent | ComponentType<DataTableEditComponentProps<TData, TValue>> | A custom inline editor for this column's cells (needs editable). |
filterComponent | ComponentType<ColumnInputProps<TData, TValue>> | A custom value input for this column in the filter panel. |