DocsAPI Reference

API Reference

Table Instance APIs

All the table instance methods and objects that can be accessed from the table instance in Shadcn Table

NOTE: These are NOT the table options for Shadcn Table. These are just static methods on a table instance that you can use.

These are the methods available on the table instance that is returned from the useShadcnTable hook. You can use these methods to interact with the table instance.

const columns = useMemo(() => [
  {
    accessor: 'name',
    header: 'Name',
    Cell: ({ cell, table }) => <span onClick={() => table.{/* or maybe here */}}></span>,
  },
], []);

const table = useShadcnTable({
  columns,
  data,
  renderTopToolbarCustomActions: ({ table }) => <Button onClick={() => table{/* or maybe here */}}>Click Me</Button>,
});

const someEventHandler = () => {
  table. //call any of the table instance methods here
};

return <ShadcnTable table={table} />;
State OptionTypeDescription
firstPage
getAllColumns
getAllFlatColumns
getAllLeafColumns
getBottomRows
getCanNextPage
getCanPreviousPage
getCanSomeRowsExpand
getCenterFlatHeaders
getCenterFooterGroups
getCenterHeaderGroups
getCenterLeafColumns
getCenterLeafHeaders
getCenterRows
getCenterTotalSize
getCenterVisibleLeafColumns
getColumn
getCoreRowModel
getEndFlatHeaders
getEndFooterGroups
getEndHeaderGroups
getEndLeafColumns
getEndLeafHeaders
getEndTotalSize
getEndVisibleLeafColumns
getExpandedDepth
getExpandedRowModel
getFilteredRowModel
getFilteredSelectedRowModel
getFlatHeaders
getFooterGroups
getGlobalAutoFilterFn
getGlobalFacetedMinMaxValues
getGlobalFacetedRowModel
getGlobalFacetedUniqueValues
getGlobalFilterFn
getGroupedRowModel
getGroupedSelectedRowModel
getHeaderGroups
getIsAllColumnsVisible
getIsAllPageRowsSelected
getIsAllRowsExpanded
getIsAllRowsSelected
getIsSomeColumnsPinned
getIsSomeColumnsVisible
getIsSomePageRowsSelected
getIsSomeRowsExpanded
getIsSomeRowsPinned
getIsSomeRowsSelected
getLeafHeaders
getPageCount
getPageOptions
getPaginatedRowModel
getPreExpandedRowModel
getPreFilteredRowModel
getPreGroupedRowModel
getPrePaginatedRowModel
getPreSelectedRowModel
getPreSortedRowModel
getRow
getRowCount
getRowModel
getSelectedRowModel
getSortedRowModel
getStartFlatHeaders
getStartFooterGroups
getStartHeaderGroups
getStartLeafColumns
getStartLeafHeaders
getStartTotalSize
getStartVisibleLeafColumns
getToggleAllColumnsVisibilityHandler
getToggleAllPageRowsSelectedHandler
getToggleAllRowsExpandedHandler
getToggleAllRowsSelectedHandler
getTopRows
getTotalSize
getVisibleFlatColumns
getVisibleLeafColumns
initialState
lastPage
nextPage
options
previousPage
refs
reset
resetColumnFilters
resetColumnOrder
resetColumnPinning
resetColumnSizing
resetColumnVisibility
resetExpanded
resetGlobalFilter
resetGrouping
resetHeaderSizeInfo
resetPageIndex
resetPageSize
resetPagination
resetRowPinning
resetRowSelection
resetSorting
setColumnFilterFns
setColumnFilters
setColumnOrder
setColumnPinning
setColumnResizing
setColumnSizing
setColumnVisibility
setCreatingRow
setDensity
setDraggingColumn
setDraggingRow
setEditingCell
setEditingRow
setExpanded
setGlobalFilter
setGlobalFilterFn
setGrouping
setHoveredColumn
setHoveredRow
setIsFullScreen
setOptions
setPageIndex
setPageSize
setPagination
setRowPinning
setRowSelection
setShowAlertBanner
setShowColumnFilters
setShowGlobalFilter
setShowToolbarDropZone
setSorting
stateST_TableState<TData>The current table state: the TanStack Table slices plus the ST-only slices (density, isFullScreen, showColumnFilters, creatingRow, ...). The table that row, cell, header and column renderers receive has no state; read table.store.state or table.atoms.<slice>.get() there.
storeReadonlyStore<ST_TableState<TData>>The TanStack Store behind table.state. Subscribe to it (or to the per-slice atoms in table.atoms) to react to state changes outside of React renders.
toggleAllColumnsVisible
toggleAllPageRowsSelected
toggleAllRowsExpanded
toggleAllRowsSelected

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