PivotGrid
The records of the ambient <List> as a table of rows by columns, with row, column and grand totals. The grid fetches nothing, so give the list a perPage that covers every record to pivot. count, the default, counts records; sum, avg, min and max read valueSource and skip values that are not numbers. A total aggregates the raw values, not the cells. A record with no row or column value lands in a (none) row or column.
Installation
pnpm dlx shadcn@latest add @chelone/pivot-gridThe records of the ambient <List> as a table of rows by columns, with row, column and grand totals. The grid fetches nothing, so give the list a perPage that covers every record to pivot. count, the default, counts records; sum, avg, min and max read valueSource and skip values that are not numbers. A total aggregates the raw values, not the cells. A record with no row or column value lands in a (none) row or column.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| aggregator | PivotAggregator | — | Default `count`. |
| className | string | — | |
| columnSource | SourceProp<TRecord> | — | The field whose values become the columns. |
| empty | ReactNode | — | Rendered with no records, in place of `ListNoResults`. |
| format | (value: number) => ReactNode | — | Prints a number in place of the locale's default text. |
| loading | ReactNode | — | Rendered while the list is pending, in place of `SimpleListLoading`. |
| rowSource | SourceProp<TRecord> | — | The field whose values become the rows; a dotted path reads a nested value. |
| valueSource | SourceProp<TRecord> | — | The field the aggregator reads. Unused by `count`. |