Skip to content

Column options

SST_ColumnDef<TData, TValue> describes a single column. It extends the underlying TanStack Table v8 ColumnDef with extra options for filtering UI, editing, slot props, and column-level enable flags.

import { type SST_ColumnDef } from 'shadstack-table';
const columns: SST_ColumnDef<Person>[] = [
{ accessorKey: 'id', header: 'ID', size: 60 },
{ accessorKey: 'firstName', header: 'First name' },
{ accessorKey: 'lastName', header: 'Last name' },
];

Memoize the array (useMemo) — re-creating it re-renders the whole table.

KindHow you declare itWhat it’s for
DataaccessorKey: 'firstName' or accessorFn: (row) => …Renders a value from each row.
Displayid: 'actions' with Cell: ({ row }) => …, no accessorRenders UI that isn’t a row field — actions, custom selection, etc.
Groupheader: 'Name', columns: [colA, colB]A parent header spanning two or more child columns.

See the data columns guide and display columns guide for the full pattern reference, including the built-in sst-row-* display columns.

OptionTypeDescription
idstringStable identifier. Required for display columns. Defaults to accessorKey (string) for data columns.
accessorKeykeyof TDataReads a value via row[key]. Use for data columns.
accessorFn(row: TData) => unknownReads a value via a function — derived/composed values, computed fields.
headerstring | (props) => ReactNodeHeader content. String form goes through getHeader(); function form returns the rendered node.
OptionTypeDescription
Cell(props) => ReactNodeOverride the entire cell. Receives { row, cell, column, table, renderedCellValue }.
Header(props) => ReactNodeOverride the header. Receives { column, header, table }.
Footer(props) => ReactNodeOverride the footer cell. Same shape as Header.
Edit(props) => ReactNodeOverride the edit-mode editor for this column. Receives { cell, column, row, table }.
Filter(props) => ReactNodeOverride the filter input rendered in the column header.
OptionTypeDescription
enableSortingbooleanAllow sorting on this column. Default true for data columns.
sortingFnSST_SortingFn<TData> | keyof typeof sortingFnsPick a built-in ('alphanumeric', 'datetime', …) or supply your own.
sortUndefined1 | -1 | falseWhere to place undefined values when sorting.
invertSortingbooleanReverse the comparator output (useful for “rank” columns).
OptionTypeDescription
enableColumnFilterbooleanShow the in-header filter for this column. Default true for data columns.
filterFnSST_FilterFn<TData> | keyof typeof filterFnsPick a built-in ('fuzzy', 'contains', 'equals', 'between', …) or supply your own.
filterVariant'text' | 'select' | 'multi-select' | 'range' | 'range-slider' | 'checkbox' | 'date' | 'date-range' | 'autocomplete'Which filter UI to render. Defaults to 'text'. date / date-range use a shadcn Popover + Calendar; time / datetime variants fall back to native inputs.
filterSelectOptionsstring[] | { label, value }[]Options for select / multi-select / autocomplete filter variants.
filterFnRangeOptions{ min, max, step? }Range bounds for range-slider filter variant.
OptionTypeDescription
enableEditingboolean | ((row) => boolean)Allow editing on cells of this column. Combine with editDisplayMode in SST_TableOptions.
editVariant'text' | 'select'Which editor to render — text input or select.
editSelectOptionsstring[] | { label, value }[]Options for select editor.

Every cell, header, footer, filter input, and edit input accepts slotProps for per-column className / prop overrides. These accept either a plain object or a (props) => object callback:

{
accessorKey: 'status',
header: 'Status',
slotProps: {
tableBodyCell: ({ cell }) => ({
className: cell.getValue() === 'active' ? 'text-success' : 'text-muted-foreground',
}),
},
}

Common slot props on a column: tableHeadCell, tableBodyCell, tableFooterCell, filterTextField, editCellTextField, columnActionsButton, expandButton.