File: expanding.md | Updated: 11/15/2025
Search...
+ K
Auto
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide
Documentation
Framework
React
Version
Latest
Search...
+ K
Menu
Getting Started
Core Guides
Feature Guides
Core APIs
Feature APIs
Enterprise
Examples
Framework
React
Version
Latest
Menu
Getting Started
Core Guides
Feature Guides
Core APIs
Feature APIs
Enterprise
Examples
On this page
Copy Markdown
Expanding state is stored on the table using the following shape:
tsx
export type ExpandedState = true | Record<string, boolean>
export type ExpandedTableState = {
expanded: ExpandedState
}
export type ExpandedState = true | Record<string, boolean>
export type ExpandedTableState = {
expanded: ExpandedState
}
Row API
-------
### toggleExpanded
tsx
toggleExpanded: (expanded?: boolean) => void
toggleExpanded: (expanded?: boolean) => void
Toggles the expanded state (or sets it if expanded is provided) for the row.
tsx
getIsExpanded: () => boolean
getIsExpanded: () => boolean
Returns whether the row is expanded.
tsx
getIsAllParentsExpanded: () => boolean
getIsAllParentsExpanded: () => boolean
Returns whether all parent rows of the row are expanded.
tsx
getCanExpand: () => boolean
getCanExpand: () => boolean
Returns whether the row can be expanded.
tsx
getToggleExpandedHandler: () => () => void
getToggleExpandedHandler: () => () => void
Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to an event handler to a button.
Table Options
-------------
### manualExpanding
tsx
manualExpanding?: boolean
manualExpanding?: boolean
Enables manual row expansion. If this is set to true, getExpandedRowModel will not be used to expand rows and you would be expected to perform the expansion in your own data model. This is useful if you are doing server-side expansion.
tsx
onExpandedChange?: OnChangeFn<ExpandedState>
onExpandedChange?: OnChangeFn<ExpandedState>
This function is called when the expanded table state changes. If a function is provided, you will be responsible for managing this state on your own. To pass the managed state back to the table, use the tableOptions.state.expanded option.
tsx
autoResetExpanded?: boolean
autoResetExpanded?: boolean
Enable this setting to automatically reset the expanded state of the table when expanding state changes.
tsx
enableExpanding?: boolean
enableExpanding?: boolean
Enable/disable expanding for all rows.
tsx
getExpandedRowModel?: (table: Table<TData>) => () => RowModel<TData>
getExpandedRowModel?: (table: Table<TData>) => () => RowModel<TData>
This function is responsible for returning the expanded row model. If this function is not provided, the table will not expand rows. You can use the default exported getExpandedRowModel function to get the expanded row model or implement your own.
tsx
getIsRowExpanded?: (row: Row<TData>) => boolean
getIsRowExpanded?: (row: Row<TData>) => boolean
If provided, allows you to override the default behavior of determining whether a row is currently expanded.
tsx
getRowCanExpand?: (row: Row<TData>) => boolean
getRowCanExpand?: (row: Row<TData>) => boolean
If provided, allows you to override the default behavior of determining whether a row can be expanded.
tsx
paginateExpandedRows?: boolean
paginateExpandedRows?: boolean
If true expanded rows will be paginated along with the rest of the table (which means expanded rows may span multiple pages).
If false expanded rows will not be considered for pagination (which means expanded rows will always render on their parents page. This also means more rows will be rendered than the set page size)
Table API
---------
### setExpanded
tsx
setExpanded: (updater: Updater<ExpandedState>) => void
setExpanded: (updater: Updater<ExpandedState>) => void
Updates the expanded state of the table via an update function or value
tsx
toggleAllRowsExpanded: (expanded?: boolean) => void
toggleAllRowsExpanded: (expanded?: boolean) => void
Toggles the expanded state for all rows. Optionally, provide a value to set the expanded state to.
tsx
resetExpanded: (defaultState?: boolean) => void
resetExpanded: (defaultState?: boolean) => void
Reset the expanded state of the table to the initial state. If defaultState is provided, the expanded state will be reset to {}
tsx
getCanSomeRowsExpand: () => boolean
getCanSomeRowsExpand: () => boolean
Returns whether there are any rows that can be expanded.
### getToggleAllRowsExpandedHandler
tsx
getToggleAllRowsExpandedHandler: () => (event: unknown) => void
getToggleAllRowsExpandedHandler: () => (event: unknown) => void
Returns a handler that can be used to toggle the expanded state of all rows. This handler is meant to be used with an input[type=checkbox] element.
tsx
getIsSomeRowsExpanded: () => boolean
getIsSomeRowsExpanded: () => boolean
Returns whether there are any rows that are currently expanded.
tsx
getIsAllRowsExpanded: () => boolean
getIsAllRowsExpanded: () => boolean
Returns whether all rows are currently expanded.
tsx
getExpandedDepth: () => number
getExpandedDepth: () => number
Returns the maximum depth of the expanded rows.
tsx
getExpandedRowModel: () => RowModel<TData>
getExpandedRowModel: () => RowModel<TData>
Returns the row model after expansion has been applied.
tsx
getPreExpandedRowModel: () => RowModel<TData>
getPreExpandedRowModel: () => RowModel<TData>
Returns the row model before expansion has been applied.
