UnifiedBreakdownTable
A generic typed DataGridPro wrapper for breakdown data tables. Supports sortable columns, column filtering, pagination, and type-safe row definitions via the generic <TRow> parameter.
Live DataGridPro Table
Dataset Toggle
The same UnifiedBreakdownTable component handles different data shapes via its generic <TRow> type parameter. Toggle between orders and items to see different column definitions and row structures.
Usage
import { UnifiedBreakdownTable } from '@so.boss/gloss-ui';
import type { ColumnDef } from '@so.boss/gloss-ui';
interface ProductRow {
id: string;
name: string;
quantity: number;
revenue: number;
}
const columns: ColumnDef<ProductRow>[] = [
{ field: 'name', headerName: 'Product', flex: 1, minWidth: 200 },
{ field: 'quantity', headerName: 'Qty', width: 100, align: 'right', headerAlign: 'right' },
{ field: 'revenue', headerName: 'Revenue', width: 150, align: 'right', headerAlign: 'right',
renderCell: ({ row }) => `$${row.revenue.toLocaleString()}` },
];
<UnifiedBreakdownTable<ProductRow>
columns={columns}
data={productData}
pagination={{
page: 0,
pageSize: 10,
total: productData.length,
onPageChange: (page, pageSize) => { /* handle */ },
}}
/>