row-expanding

Configure row expansion and collapsing in TanStack Table with expandedRowModel.

28.3k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill row-expanding
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: row-expanding
Source: https://github.com/TanStack/table/tree/main/packages/table-core/skills/row-expanding
Command: npx skills add https://github.com/TanStack/table --skill row-expanding

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you add reliable row expansion to TanStack Table so users can drill into hierarchical sub-rows or reveal per-row detail panels without losing control over markup and behavior.

Core Features & Use Cases

  • Tree sub-rows via expandedRowModel: Support nested datasets using getSubRows, with state-driven expansion using state.expanded and onExpandedChange.
  • Detail panels for flat data: Expand individual rows to render an additional UI section (e.g., an info panel) using getRowCanExpand and row.getIsExpanded().
  • Pagination and filtering interactions: Control whether expanded children participate in paging via paginateExpandedRows and ensure parent visibility during tree filtering via filterFromLeafRows and maxLeafRowFilterDepth.

Quick Start

Use the row-expanding Skill to configure rowExpandingFeature with createExpandedRowModel(), register either getSubRows (tree mode) or getRowCanExpand (detail-panel mode), then render an expander that calls row.getToggleExpandedHandler() and conditionally displays expanded children or a sub-component.

Frequently Asked Questions about row-expanding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expand rows in TanStack Table to show hierarchical tree data?

To expand rows in TanStack Table for hierarchical tree data, use the expandedRowModel alongside getSubRows to define nested data structures. State-driven expansion is managed via state.expanded and onExpandedChange to control which rows are open.

How do I add a detail panel to flat data in TanStack Table?

To add a detail panel to flat data in TanStack Table, use getRowCanExpand to enable expansion on specific rows. You can then check row.getIsExpanded() to conditionally render an additional UI section like an info panel.

Does TanStack Table pagination work with expanded sub-rows?

TanStack Table pagination works with expanded sub-rows using the paginateExpandedRows setting. This controls whether expanded children participate in paging calculations alongside the parent rows.

How does TanStack Table filtering interact with expanded tree rows?

TanStack Table filtering interacts with expanded tree rows using filterFromLeafRows and maxLeafRowFilterDepth. These settings ensure parent visibility is maintained during tree filtering by honoring leaf-match propagation.

What is the best way to toggle all expanded rows in TanStack Table?

The best way to toggle all expanded rows in TanStack Table is using the table toggle-all API. This works alongside individual row.toggleExpanded calls to manage the overall ExpandedState for the table.

Why do my TanStack Table expanded rows collapse when filtering or paging?

Expanded rows collapse during filtering or paging if the ExpandedState is not properly managed. Ensure you use state-driven control with state.expanded and configure paginateExpandedRows to maintain the expanded state correctly.