Shadcn React Table

Search documentation

Search the docs

Table instance (table.cnTable)

useDataTable returns the standard TanStack table instance with one addition: a cnTable object holding the table's resolved configuration and UI state. Components read from it instead of prop drilling; you can read and call into it too.

table.cnTable.beginCreate()       // open the create-row form
table.cnTable.setDensity("compact")
const isLoading = table.cnTable.isLoading
MemberTypeDescription
localizationDataTableLocalization
iconsDataTableIcons
densityDensity
setDensityReact.Dispatch<React.SetStateAction<Density>>
isFullscreenboolean
setIsFullscreenReact.Dispatch<React.SetStateAction<boolean>>
showColumnFiltersboolean
setShowColumnFiltersReact.Dispatch<React.SetStateAction<boolean>>
columnFilterModesRecord<string, FilterMode>Active filter mode per column id.
setColumnFilterMode(columnId: string, mode: FilterMode) => voidSwitch a column's filter mode (resets the value when it becomes invalid).
globalFilterModeGlobalFilterMode
setGlobalFilterMode(mode: GlobalFilterMode) => void
enableGlobalFilterboolean
enableGlobalFilterModesboolean
enableAdvancedFilterbooleanCompound AND/OR filter panel (independent of, and additive to, the per-column filters and global search).
advancedFilterAdvancedFilterGroup
setAdvancedFilterReact.Dispatch<React.SetStateAction<AdvancedFilterGroup>>
showAdvancedFilterPanelboolean
setShowAdvancedFilterPanelReact.Dispatch<React.SetStateAction<boolean>>
isLoadingboolean
isSavingboolean
showProgressBarsboolean
showSkeletonsboolean
showLoadingOverlayboolean
enableFacetedValuesboolean
enableColumnActionsboolean
enableColumnFiltersboolean
enableColumnFilterModesboolean
enableFilterMatchHighlightingboolean
columnsWithCustomCellReadonlySet<string>Column ids that supply a custom cell renderer (skipped by auto-highlight).
enableColumnOrderingboolean
enableColumnPinningboolean
enableColumnResizingboolean
enableColumnAutosizeboolean
autoSizeColumn(columnId: string) => voidResize a single column to fit its widest visible value (header + data).
autoSizeAllColumns() => voidAuto-size every resizable visible column.
enableRowOrderingboolean
enableRowPinningboolean
enableRowNumbersboolean
rowNumberMode"static" | "original"
onRowOrderChange?(activeRowId: string, overRowId: string) => voidCalled on a row drag-and-drop reorder; the consumer reorders its data.
enableGroupingboolean
enableExpandingboolean
enableStickyFooterboolean
renderDetailPanel?(props: { row: Row<TData> table: DataTableInstance<TData> }) => React.ReactNode
enableEditingboolean
editDisplayModeEditDisplayMode
createDisplayModeCreateDisplayMode
editingCellEditingCell | null
setEditingCellReact.Dispatch<React.SetStateAction<EditingCell | null>>
editingRowIdstring | null
isCreatingboolean
rowDraftRecord<string, unknown>Draft values for the row/modal editor + create form, keyed by column id.
setRowDraftValue(columnId: string, value: unknown) => void
beginRowEdit(row: Row<TData>) => voidEnter row/modal editing for a row, seeding the draft from its values.
beginCreate() => voidOpen the create form, seeding the draft from `createRowDefaults`.
cancelEdit() => voidExit any editing/creating state, discarding the draft.
enableClickToCopyboolean
onEditCellSave?(props: { row: Row<TData> column: Column<TData, unknown> value: unknown table: DataTableInstance<TData> }) => void
onSaveRow?(props: { row: Row<TData> values: Record<string, unknown> table: DataTableInstance<TData> exit: () => void }) => void
onCreateRow?(props: { values: Record<string, unknown> table: DataTableInstance<TData> exit: () => void }) => void
renderRowActions?(props: { row: Row<TData> table: DataTableInstance<TData> }) => React.ReactNode
renderCellActionMenuItems?(props: { cell: Cell<TData, unknown> row: Row<TData> table: DataTableInstance<TData> }) => React.ReactNode
renderRowActionMenuItems?(props: { row: Row<TData> table: DataTableInstance<TData> }) => React.ReactNode
renderColumnActionsMenuItems?(props: { column: Column<TData, unknown> table: DataTableInstance<TData> }) => React.ReactNode
renderColumnFilterModeMenuItems?(props: { column: Column<TData, unknown> modes: FilterMode[] currentMode: FilterMode onSelect: (mode: FilterMode) => void table: DataTableInstance<TData> }) => React.ReactNode
renderGlobalFilterModeMenuItems?(props: { modes: GlobalFilterMode[] currentMode: GlobalFilterMode onSelect: (mode: GlobalFilterMode) => void table: DataTableInstance<TData> }) => React.ReactNode
onRowClick?(props: RowEvent<TData>) => void
onRowDoubleClick?(props: RowEvent<TData>) => void
onCellClick?(props: CellEvent<TData>) => void
onCellDoubleClick?(props: CellEvent<TData>) => void
refsDataTableRefsDOM refs to the table's structural elements (populated after mount).
enableRowVirtualizationboolean
enableColumnVirtualizationboolean
estimateRowHeightnumber
virtualOverscannumber
rowVirtualizerOptions?RowVirtualizerOptions<TData>
columnVirtualizerOptions?ColumnVirtualizerOptions<TData>
rowVirtualizerInstanceRef?React.RefObject<DataTableRowVirtualizer | null>
columnVirtualizerInstanceRef?React.RefObject<DataTableColumnVirtualizer | null>
enableExportboolean
exportFileName?string
enableStickyHeaderboolean
enablePaginationboolean
positionPagination"top" | "bottom" | "both" | "none"
paginationDisplayModePaginationDisplayMode
columnFilterDisplayModeColumnFilterDisplayMode
positionGlobalFilter"left" | "right" | "none"
positionToolbarAlertBanner"top" | "bottom" | "none"
positionToolbarDropZone"top" | "bottom" | "both" | "none"
enableRowSelectionboolean
enableTopToolbarboolean
enableBottomToolbarboolean
enableDensityToggleboolean
enableFullscreenToggleboolean
enableToolbarInternalActionsboolean
enableKeyboardNavigationboolean
title?React.ReactNode
renderToolbarActions?(props: DataTableSlotProps<TData>) => React.ReactNode
renderTopToolbar?(props: DataTableSlotProps<TData>) => React.ReactNode
renderBottomToolbar?(props: DataTableSlotProps<TData>) => React.ReactNode
renderToolbarInternalActions?( props: DataTableSlotProps<TData> ) => React.ReactNode
renderBottomToolbarCustomActions?( props: DataTableSlotProps<TData> ) => React.ReactNode
renderCaption?(props: DataTableSlotProps<TData>) => React.ReactNode
renderEmpty?(props: DataTableSlotProps<TData>) => React.ReactNode

Everything else is TanStack

All standard instance methods — getState, getRowModel, getColumn, setPageIndex, getFilteredRowModel, resetSorting, … — are available directly on table as usual.