DocsAPI Reference

API Reference

Column Options

All the column options that can be used in Shadcn Table

Many of the column options you can pass here are the same as the ones that you can pass to the TanStack Table ColumnDefs

Here is a list of all the column options you can specify in a column definition.

const columns = useMemo(
  () => [
    {
      accessorKey: 'name',
      header: 'Name',
      // All of the options you can specify here
    },
  ],
  [],
);

const table = useShadcnTable({ columns, data });

return <ShadcnTable table={table} />;
Column OptionTypeDescription
AggregatedCell({ cell, column, row, table }) => ReactNodeDefine a custom cell render for an aggregated cell.
Cell({ cell, column, renderedCellValue, row, table }) => ReactNodeDefine a custom cell render to add markup, styles, or conditional logic.
Edit({ cell, column, row, table }) => ReactNodeDefine a custom edit component for cells in a column.
Filter({ column, header, table }) => ReactNodeDefine a custom filter component in a column.
ReactNode | ({ column, footer, table }) => ReactNodeRender custom markup for a column footer.
GroupedCell({ cell, column, row, table }) => ReactNodeDefine a custom cell render for a grouped cell.
HeaderReactNode | (({ column, header, table }) => ReactNode)Render custom markup for a column header.
PlaceholderCell({ cell, column, row, table }) => ReactNodeDefine a custom cell render for a placeholder cell.
accessorFn(originalRow: TData) => anyAlternative to an accessorKey, define an accessor function instead of a string key.
accessorKeystring & keyof TDataIf provided, the accessorKey will be used to point to which key in the data object should be used to access the data in this column.
aggregationFnST_AggregationFn<TData> | Array<ST_AggregationFn<TData>>Specify which aggregate function(s) should be used for grouped columns: a built-in name, a name from the aggregationFns table option, a constructAggregationFn({ aggregate, merge? }) definition, or an array of those. TanStack Table core resolves the names, and an unknown name aggregates nothing.
columnFilterModeOptionsArray<string>
columnsArray<ST_ColumnDef<TData>>If using header groups, define an array of sub columns here.
editSelectOptionsDropdownOption[] | (({ cell, column, row, table, }) => DropdownOption[])
editVariant'text' | 'select'
enableClickToCopyboolean | 'context-menu' | ((cell: ST_Cell<TData>) => 'context-menu' | boolean)Enable the click to copy feature for this column.
enableColumnActionsbooleanEnable or disable column actions for this column.
enableColumnDraggingbooleanEnable or disable column dragging for this column.
enableColumnFilterbooleanEnable or disable column filtering for this column. Filter will not be shown if disabled.
enableColumnFilterModesbooleanFilter modes are on by default; set false to hide the filter mode picker for this column.
enableColumnOrderingbooleanSet it to false to lock the column: it cannot be dragged, and while another column drags it shows a lock with "Fixed" and refuses the drop. The column menu shows a disabled "Fixed position" item. The built-in display columns other than row actions are locked by default.
enableEditingboolean | (row) => boolean
enableFilterMatchHighlightingbooleanEnable or disable filter match highlighting for this column.
enableGlobalFilterboolean
enableGroupingboolean
enableHidingboolean
enableMultiSortboolean
enablePinningboolean
enableResizingboolean
enableSortingboolean
filterDebounceMsnumberOverrides the columnFilterDebounceMs table option for this column.
filterFnST_FilterFnA built-in filter name, a name registered through the filterFns table option, or a filter function. TanStack Table core resolves the name, and an unknown name filters nothing. After the table prepares its columns, columnDef.filterFn holds the current filter mode name; read it with getColumnFilterFnName(columnDef).
filterSelectOptionsArray<string | { label: string; value: string }>
filterVariant'text' | 'select' | 'multi-select' | 'range' | 'range-slider' | 'checkbox' | 'autocomplete' | 'date' | 'date-range' | 'datetime' | 'datetime-range' | 'time' | 'time-range'Specify whether the filter should be a text input or a select input, or other type of pre-built input.
getGroupingValue(row: TData) => any)Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from accessorKey / accessorFn will be used instead.
growboolean | numberIf `layoutMode` is `'grid'` (the default) or `'grid-no-grow'`, set the flex grow value for a column, or `false`/0 to keep it at its set width. In the default layout display columns and pinned columns do not grow; a data column grows in the ratio of its size.
header*string
iconComponentType<ST_IconProps> | ReactNodeAn icon component or element shown before the column label in the header, in the filter chips and in the column picker of the filter and sort editors. Nothing renders when it is unset.
idstring
invertSortingboolean
maxSizenumber
metaany
minSizenumber
overflowTooltipfalse | 'value' | ({ cell, column, row, table }) => ReactNodeThe tooltip a cut-off body cell shows: false turns it off for this column, 'value' shows the cell value, a function renders the content.
renderCellActionMenuItems{ cell, closeMenu, column, internalMenuItems, row, staticColumnIndex, staticRowIndex, table }) => ReactNode[]
renderColumnActionsMenuItems({ closeMenu, column, internalColumnMenuItems, table }) => ReactNode[]
renderColumnFilterModeMenuItems
sizenumber
sortDescFirstboolean
sortFnSortFnOptionThe sorting function to use for this column: the name of a built-in or custom (sortFns table option) sorting function, or a sorting function itself. TanStack Table core resolves the name, and an unknown name sorts nothing.
sortUndefined'first' | 'last' | false | 1 | -1
stColumnActionsButtonPropsIconButtonProps | ({ column, table }) => IconButtonProps
stColumnDragHandlePropsIconButtonProps | ({ column, table }) => IconButtonProps
stCopyButtonPropsButtonProps | ({ cell, column, row, table }) => ButtonProps
stEditTextFieldPropsTextFieldProps | ({ cell, column, row, table }) => TextFieldProps
stFilterAutocompletePropsAutocompleteProps | ({ column, rangeFilterIndex, table }) => AutocompleteProps
stFilterCheckboxPropsCheckboxProps | ({ column, table }) => CheckboxProps
stFilterDatePickerPropsDatePickerProps | ({ column, rangeFilterIndex, table }) => DatePickerProps
stFilterDateTimePickerPropsDateTimePickerProps | ({ column, rangeFilterIndex, table }) => DateTimePickerProps
stFilterSliderPropsSliderProps | ({ column, table}) => SliderProps
stFilterTextFieldPropsTextFieldProps | ({ column, rangeFilterIndex, table }) => TextFieldProps
stFilterTimePickerPropsTimePickerProps | ({ column, rangeFilterIndex, table }) => TimePickerProps
stTableBodyCellPropsTableCellProps | ({ cell, table }) => TableCellProps
stTableFooterCellPropsTableCellProps | ({ column, table }) => TableCellProps
stTableHeadCellPropsTableCellProps | ({ column, table }) => TableCellProps
visibleInShowHideMenubooleanSet to false if you want to hide a column from the show/hide menu.

Wanna see the source code for this table? Check it out down below!