gridcn1.2.2

Column groups

Put a shared header over a run of columns, nested up to 8 levels deep.

Three groups sit above the columns: Contact, Work, and Standing. Work holds a nested History group, so the header has three rows. Name is pinned left, so the Contact header splits at the pin edge. Click a group header to select its columns. Drag a group header to move the block, or drag a column inside its group.

Click a group header to select its columns. Drag a group header to move the whole block, or drag a column within its group. Hide every column of a group and its header disappears.

Contact
Contact
Work
Standing
History
Name
Email
Role
Score
Active
Joined
Age
Silent Tiger
user0@example.com
Viewer
2023-07-05
63
4
Quick Lion
user1@example.com
Viewer
2021-04-03
67
89
Swift Wolf
user2@example.com
Manager
2020-10-27
40
80
Eager Lion
user3@example.com
User
2022-10-08
50
51
Eager Tiger
user4@example.com
Viewer
2024-10-07
45
83
Silent Wolf
user5@example.com
User
2020-06-01
24
15
Swift Lion
user6@example.com
Viewer
2022-10-18
34
62
Eager Lion
user7@example.com
Manager
2021-10-07
21
42
Eager Eagle
user8@example.com
Editor
2024-06-11
25
35
Bold Tiger
user9@example.com
Editor
2024-03-20
19
52
Bold Bear
user10@example.com
User
2020-04-16
42
28
Swift Wolf
user11@example.com
Manager
2022-08-04
47
9
pnpm dlx shadcn@latest add @gridcn/data-grid-column-groups-demo

What's in the demo

  • columnGroups: a list of { id, header, children } groups. children holds column ids and nested groups
  • A group header press selects the group's columns
  • A group header drag moves the block inside its parent group
  • The columns menu lists the members of each group under the group label

Behavior reference

On this page