View as Markdown

Stacked Headers

Stacked headers

Group columns under multi-level headers with nested column definitions; operations act on the leaf columns.

A column with child columns is a column group: its header spans its children and the header gains one row per level, with no depth limit. Nested <DataGridColumn> children are the JSX form of the same tree. Give every group an id so its state is keyed by a stable column id.

const columns = [
  { field: 'id', header: 'Order', pinned: 'start' },
  {
    id: 'customerGroup',
    header: 'Customer',
    columns: [
      { field: 'customer', header: 'Name' },
      { id: 'location', header: 'Location', columns: [{ field: 'country' }, { field: 'city' }] },
    ],
  },
];

Leaf operations

Only leaf columns hold data, so sorting, filtering, resizing and the column menu act on leaves; group header cells are not keyboard focus stops. Reordering moves a leaf within its parent group and rejects a move out of it, so groups never break apart.

Group headers take the same header options as leaves: headerAlign (centered by default), headerProps for a class name, style, title or data-* attributes, and renderHeader for custom content. Group headers expose aria-colspan, and leaves under a shallower branch span the remaining header rows with aria-rowspan.

Pinning and virtualization

A group whose leaves end up in different pin zones is split at the zone edge, one header cell per zone, with a development warning; pin whole groups or top-level leaves to avoid it. Column virtualization stays on under stacked headers: a group header spans the run of its rendered leaves.

The column chooser lists the groups as an indented tree above their leaves.

Stacked headers

Open demo

Three header levels from nested columns, with group headerAlign, headerProps and renderHeader; leaf sorting, filtering, resizing and reordering within the parent group; a pinned leaf beside the groups; and the column chooser listing the hierarchy.

Order
Customer
Product
Sales USD
Placed
Name
Location
Item
Category
Qty
Unit price
Discount
Amount
Country
City
ORD-10000
Aiko Tan
France
Lyon
Oolong tea
Tea
7
$12.75
15%
$75.86
Nov 25, 2026
ORD-10001
Hana Sato
Germany
Berlin
Filter beans
Coffee
9
$14.00
15%
$107.10
Mar 23, 2026
ORD-10002
Bao Nguyen
Japan
Osaka
Grinder
Equipment
5
$129.00
5%
$612.75
Nov 4, 2026
ORD-10003
Farah Aziz
Malaysia
Penang
Kettle
Equipment
8
$64.90
0%
$519.20
Jun 4, 2026
ORD-10004
Goran Petrov
Malaysia
Penang
Green tea
Tea
6
$9.25
0%
$55.50
May 8, 2026
ORD-10005
Chen Wei
Japan
Osaka
Green tea
Tea
12
$9.25
5%
$105.45
Aug 14, 2026
ORD-10006
Jun Park
Japan
Tokyo
Espresso beans
Coffee
4
$18.50
0%
$74.00
Aug 28, 2026
ORD-10007
Chen Wei
Japan
Osaka
Filter beans
Coffee
11
$14.00
15%
$130.90
Oct 1, 2026
ORD-10008
Aiko Tan
France
Lyon
Oolong tea
Tea
2
$12.75
10%
$22.95
Feb 10, 2026
ORD-10009
Dewi Lestari
Germany
Munich
Espresso beans
Coffee
1
$18.50
5%
$17.58
Aug 25, 2026
ORD-10010
Chen Wei
Japan
Osaka
Green tea
Tea
2
$9.25
10%
$16.65
Feb 6, 2026
ORD-10011
Farah Aziz
Germany
Munich
Oolong tea
Tea
6
$12.75
10%
$68.85
Mar 16, 2026
ORD-10012
Hana Sato
Germany
Munich
Filter beans
Coffee
2
$14.00
15%
$23.80
Mar 5, 2026
ORD-10013
Jun Park
Japan
Osaka
Oolong tea
Tea
12
$12.75
15%
$130.05
Jul 6, 2026
ORD-10014
Aiko Tan
France
Lyon
Kettle
Equipment
8
$64.90
0%
$519.20
Feb 27, 2026
ORD-10015
Hana Sato
Malaysia
Kuala Lumpur
Grinder
Equipment
3
$129.00
5%
$367.65
Jan 28, 2026
ORD-10016
Farah Aziz
France
Reims
Grinder
Equipment
3
$129.00
10%
$348.30
Aug 4, 2026
ORD-10017
Jun Park
Malaysia
Penang
Green tea
Tea
12
$9.25
0%
$111.00
Jan 15, 2026
ORD-10018
Chen Wei
Malaysia
Penang
Grinder
Equipment
5
$129.00
0%
$645.00
Jul 1, 2026
ORD-10019
Goran Petrov
Japan
Osaka
Filter beans
Coffee
5
$14.00
15%
$59.50
Feb 24, 2026
No events yet.

API reference

DataGridColumn (the column type and the JSX component) and the core ColumnDef list the group fields (id, header, columns, headerAlign, headerProps, renderHeader).