Collapsible Columns

Hide and show column groups to save space — click the header arrow to collapse or expand.

Enable collapsible groups

Set collapsible: true on a parent with children. Users click the header arrow to hide or show the group.

TypeScript
{
accessor: "sales",
label: "Sales",
collapsible: true,
children: [
{ accessor: "q1", label: "Q1", width: 90, type: "number" },
{ accessor: "q2", label: "Q2", width: 90, type: "number" },
{ accessor: "q3", label: "Q3", width: 90, type: "number" },
{ accessor: "q4", label: "Q4", width: 90, type: "number" },
],
}

Start collapsed

Use collapseDefault so the group loads collapsed — useful when details should stay optional.

TypeScript
{
accessor: "details",
label: "Details",
collapsible: true,
collapseDefault: true,
children: [
{ accessor: "note", label: "Note", width: 160 },
{ accessor: "owner", label: "Owner", width: 120 },
],
}

Control child visibility

Use showWhen on child columns: parentExpanded (default), parentCollapsed, or always. Common pattern: summary when collapsed, detail when expanded.

TypeScript
{
accessor: "sales",
label: "Sales",
collapsible: true,
children: [
{ accessor: "total", label: "Total", showWhen: "parentCollapsed" },
{ accessor: "q1", label: "Q1", showWhen: "parentExpanded" },
{ accessor: "q2", label: "Q2", showWhen: "parentExpanded" },
],
}

Single-row children

Set singleRowChildren: true so the parent header sits beside its children (same row) instead of above them — the parent acts like a column that collapses its neighbors.

TypeScript
{
accessor: "personalInfo",
label: "Personal Info",
collapsible: true,
singleRowChildren: true,
children: [
{ accessor: "firstName", label: "First Name", width: 120 },
{ accessor: "lastName", label: "Last Name", width: 120 },
{ accessor: "email", label: "Email", width: 200 },
],
}

Example

Single-row children example

Parent header sits in the same row as its children.

Props

Collapsible Columns Configuration

PropertyRequiredDescriptionExample
ColumnDef.collapsible
boolean
Optional
Enables expand/collapse on a parent column that has children.
ColumnDef.collapseDefault
boolean
Optional
Starts the group collapsed. Only applies when collapsible is true.
ColumnDef.showWhen
enum
Optional
When a child column is visible relative to the parent's collapse state.
Options:
parentExpanded
parentCollapsed
always
ColumnDef.singleRowChildren
boolean
Optional
Renders the parent header beside its children in one row instead of nested above them.
icons.headerExpand
ReactNode
Optional
Custom expand icon for collapsible headers.
icons.headerCollapse
ReactNode
Optional
Custom collapse icon for collapsible headers.