Skip to main content

Grouping

Prop enableGrouping — engine behaviour, default false.

Guide

When to use it

Roll rows up by a column value — orders by region, tasks by status — with collapsible group rows and aggregates.

How it works

Enables multi-column grouping plus aggregation; set a column's aggregationFn for totals / averages in the group header. Both skins add a group toggle (▤) in the columns menu.

Gotchas

  • Row virtualization yields to grouping (grouped rows render un-windowed), so very large grouped sets are heavier — group server-side at scale.
  • Off by default; it changes the row model, so turn it on only where you need it.

Live example

Grouping — collapsible group rows with aggregates

Example source
import React from 'react'
import { BstTableMui } from '@bloomskill/table-mui'
import type { BstTableColumn } from '@bloomskill/table-engine'
import '@bloomskill/table-engine/styles.css'
type Row = { id: string; name: string; team: string; role: string; score: number }
const seed: Row[] = [
{ id: '1', name: 'Ada Lovelace', team: 'Platform', role: 'Engineer', score: 92 },
{ id: '2', name: 'Alan Turing', team: 'Research', role: 'Scientist', score: 88 },
{ id: '3', name: 'Grace Hopper', team: 'Platform', role: 'Engineer', score: 95 },
{ id: '4', name: 'Katherine J.', team: 'Research', role: 'Analyst', score: 90 },
{ id: '5', name: 'Edsger Dijkstra', team: 'Platform', role: 'Architect', score: 84 },
]
const columns: BstTableColumn<Row>[] = [
{ id: 'name', accessorKey: 'name', header: 'Name' },
{ id: 'team', accessorKey: 'team', header: 'Team' },
{ id: 'role', accessorKey: 'role', header: 'Role' },
{ id: 'score', accessorKey: 'score', header: 'Score', sortFn: 'basic' },
]
export default function App() {
return (
<BstTableMui data={seed} columns={columns} getRowId={(r) => r.id}
enableGrouping initialState={{ grouping: ['team'], expanded: true }} />
)
}
Loading live example…

Overview

Layerenable* (engine, resolved in useBstTable)
Typeboolean
Defaultfalse
Maps tov9 columnGroupingFeature + rowAggregationFeature — collapsible group rows + aggregates; adapters add a group toggle (▤) in the columns menu
Status✅ done
Sincev0.15.0
Settings sheetData operations

Multi-column grouping — group rows by one or more columns, with collapsible group headers and per-column aggregates. Opt-in. Default false. Set which columns to group via initialState.grouping (or table.setGrouping); a column aggregates by declaring aggregationFn ('sum' | 'count' | 'mean' | 'min' | 'max' | 'extent' | 'uniqueCount'). Maps to v9 enableGrouping + columnGroupingFeature.

Enable it

<BstTableMui
data={rows}
columns={columns}
enableGrouping
/>

Swap BstTableMui for BstTableShadcn (and the CSS import) for the shadcn skin — same props.

Options

OptionNotes
aggregationFnRelated prop for this feature.

Behavior & interactions

  • Set which columns to group via initialState.grouping (or table.setGrouping); a column aggregates by declaring aggregationFn.

Spec coverage

Spec codes (A1, C2, X8, …) are Bst-Table's internal requirement IDs from the capability matrix; P0P2 mark the delivery phase. They are traceability tags, not part of the public API.

  • E4 · Multi-column grouping — ✅ built. v0.15.0 — enableGrouping + aggregates + group toggle