bc-grid
GitHub

Master / detail

View source

Expand a parent row to mount a detail panel underneath. The panel can render anything — a child grid, a form, a chart — and lives inside the master row's stacking context so pinned lanes stay aligned.

Details
Order #
Customer
Status
Amount
Sales rep
R-000001
Customer 00001
active
$0.00
Avery Chen
R-000002
Customer 00002
pending
$31.42
Ben Singh
R-000003
Customer 00003
closed
$62.83
Cara Diaz
R-000004
Customer 00004
active
$94.25
Drew Lin
R-000005
Customer 00005
pending
$125.66
Elena Park
R-000006
Customer 00006
closed
$157.08
Felix Roy
R-000007
Customer 00007
active
$188.50
Gita Bose
R-000008
Customer 00008
pending
$219.91
Henry Kao
R-000009
Customer 00009
closed
$251.33
Avery Chen
R-000010
Customer 00010
active
$282.74
Ben Singh
R-000011
Customer 00011
pending
$314.16
Cara Diaz
R-000012
Customer 00012
closed
$345.57
Drew Lin
R-000013
Customer 00013
active
$376.99
Elena Park
R-000014
Customer 00014
pending
$408.41
Felix Roy
R-000015
Customer 00015
closed
$439.82
Gita Bose

Try this

Click the chevron in the leftmost column to expand a row. Click again to collapse.

  • Click the chevron — the row expands and the detail panel mounts.
  • Press Right arrow on a row to expand it from the keyboard.
  • Scroll the grid — pinned columns and the detail panel scroll together.
  • Expand a second row — both stay open until collapsed.

How master / detail works

  • renderDetailPanel. The grid auto-injects a chevron column when this prop is set. The function receives { row, rowId, rowIndex } — return any React node.
  • detailPanelHeight. Number for fixed height, or (params) => number for per-row height. Auto-measurement is deferred — pick a number that fits your panel content.
  • Expansion state. Uncontrolled by default; pass expansion + onExpansionChange to control it from outside (e.g. URL state, saved view, parent component).
  • Composes with pinned columns. The detail panel spans the unpinned + right-pinned lanes; the left-pinned lane keeps its outline column with chevron. Range select still works inside the master rows.

Use cases

  • Order header → line items (this demo).
  • Customer → recent transactions / contacts / addresses.
  • Document → version history.
  • Inventory item → stock movements.