DocsAPI Reference

API Reference

State Options

All the state options that can be used in Shadcn Table

Many of the state options you can pass here are the same as the ones you can pass to the TanStack Table useTable hook. Read them back from table.state.

Here is a list of all the state options you can pass to initialState or state.

const table = useShadcnTable({
  columns,
  data,
  //note: each individual state must be mutually exclusive to `initial state` or `state`
  initialState: {
    // all the state options you can pass here
  },
  state: {
    // or here
  },
});
State OptionTypeDescription
columnFilterFns{ [key: string]: ST_FilterFn }
columnFiltersArray<{id: string, value: unknown}>an array of objects with id and value properties, representing the current filter values for each column
columnOrderArray<string>an array of strings representing the current order of the table columns
columnPinning{ start: Array<string>, end: Array<string> }an object with start and end properties, each of which is an array of strings representing the columns that are pinned to the start (left in LTR) or end (right in LTR) side of the table
columnResizingST_ColumnResizingStatean object containing information about the column resize in progress
columnSizingRecord<string, number>an object mapping column IDs to their current width in pixels
columnVisibilityRecord<string, boolean>an object mapping column IDs to a boolean indicating whether the column is currently visible
creatingRowST_Rowa variable representing the currently creating row
density'comfortable' | 'compact' | 'spacious'
draggingColumnST_Column | nulla variable representing the currently dragged column
draggingRowST_Row | nulla variable representing the currently dragged row
editingCellST_Cella variable representing the currently editing cell
editingRowST_Rowa variable representing the currently editing row
expandedRecord<string, boolean> | boolean
filterChips{ columnIds: string[]; openAnchor: 'chip' | 'header' | 'toolbar' | null; openColumnId: string | null }The filter chips shown in the toolbar, in the order they were added, and the column whose filter editor is open with where it is anchored. A chip exists before it has a value.
globalFilterany
globalFilterFnST_FilterFn
groupingArray<string>
hoveredColumnST_Column | null
hoveredRowST_Row | null
isFullScreenboolean
isLoadingboolean
isSavingboolean
pagination{ pageIndex: number, pageSize: number }
rowPinning{ top: string[], bottom: string[] }an object with top and bottom properties, each of which is an array of strings representing the rows that are pinned to the top or bottom of the table
rowSelectionRecord<string, boolean>
showAlertBannerboolean
showColumnFiltersboolean
showGlobalFilterboolean
showLoadingOverlaybooleanUnset by default, so it follows isLoading until it is set. false turns it off.
showProgressBarsbooleanUnset by default, so it follows isSaving until it is set. false turns it off.
showSkeletonsbooleanUnset by default, so it follows isLoading until it is set. false turns it off.
showToolbarDropZoneboolean
sortingArray<{ id: string, desc: boolean }>
viewSettingsST_ViewSettingsStateThe view settings panel values and the items pinned to the toolbar. rowNumbers and stickyHeader start from enableRowNumbers and enableStickyHeader.

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