Skip to main content

Master-detail

Prop enableExpanding — engine behaviour, default false.

Guide

When to use it

Master-detail — click a row to reveal a full-width panel with more detail, sub-records, or a nested table.

How it works

Adds a leading expander column and renders your renderDetail(row) as a full-width row beneath the expanded one. Control which rows can open with getRowCanExpand.

Gotchas

  • Row virtualization yields to expanding (detail rows need real DOM), so long lists with many open panels are heavier.
  • The detail panel is your React — a nested <BstTable> is fine for a different column set.

Live example

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}
enableExpanding getRowCanExpand={() => true}
renderDetail={(row) => (
<div style={{ padding: 14, background: '#f8fafc' }}>
Detail for <b>{row.name}</b>{row.role} on the {row.team} team, score {row.score}.
</div>
)} />
)
}
Loading live example…

Overview

Layerenable* (engine, resolved in useBstTable)
Typeboolean
Defaultfalse
Maps tov9 rowExpandingFeature — leading expander column + full-width detail panel row
Status✅ done
Sincev0.13.0
Settings sheetRows

Master-detail — a leading expander column; clicking it reveals a detail panel row rendered by renderDetail. Opt-in. Default false. Built on v9's rowExpandingFeature.

Enable it

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

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

Options

OptionNotes
renderDetailRelated prop for this feature.
getRowCanExpandRelated prop for this feature.
renderDetailwithout it an expanded row shows an empty detail panel

Behavior & interactions

  • Optionally narrow which rows expand with getRowCanExpand.

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.

  • A4 · Nested / master-detail — ✅ built. v0.13.0 — enableExpanding + renderDetail