Dashboard with drill-down
A department overview table that combines expandable rows,
conditional row styles for health status, and custom cell
renderers for inline progress bars. Expand any row to drill into individual team member
utilization.
Expand any row to see team member utilization.
Department
Headcount
Budget spend
Open tickets
Health
$410,000 / $420,000
98%
critical
$195,000 / $480,000
41%
good
$1,240,000 / $1,800,000
69%
good
$680,000 / $750,000
91%
at-risk
$320,000 / $600,000
53%
good
Conditional row styles
Tint rows based on a derived health field so problems are visible at a glance — no extra column needed:
const conditionalRowStyles: ConditionalStyles<Department>[] = [
{ when: r => r.health === 'critical', style: { backgroundColor: '#fff7f7' } },
{ when: r => r.health === 'at-risk', style: { backgroundColor: '#fffdf0' } },
]; Nested table in the expander
Render a second DataTable inside expandableRowsComponent.
The parent row arrives as data:
function DepartmentDetail({ data: dept }: ExpanderComponentProps<Department>) {
return (
<div style={{ padding: '12px 32px', background: '#f9fafb' }}>
<DataTable columns={memberColumns} data={dept.members} dense noHeader />
</div>
);
}
<DataTable
columns={columns}
data={departments}
expandableRows
expandableRowsComponent={DepartmentDetail}
conditionalRowStyles={conditionalRowStyles}
/> Inline progress bars in cells
Use a cell renderer for columns that need richer content than a plain value.
The renderer receives the full row, so you can derive bar width and color from the data:
{
name: 'Budget spend',
cell: r => {
const pct = Math.round((r.spent / r.budget) * 100);
const color = pct >= 95 ? '#ef4444' : pct >= 80 ? '#f59e0b' : '#6366f1';
return (
<div style={{ width: '100%' }}>
<div style={{ fontSize: 11, color: '#6b7280', marginBottom: 3 }}>
${r.spent.toLocaleString()} / ${r.budget.toLocaleString()}
</div>
<div style={{ height: 4, background: '#f3f4f6', borderRadius: 2, overflow: 'hidden' }}>
<div style={{ width: `${pct}%`, background: color, height: '100%' }} />
</div>
</div>
);
},
}