Components
ColumnCalc
A column footer calculation — a type-aware aggregation over a column's values.
Available since@crisp-ui-kit/crisp@0.11.0
A data grid ends in a sticky summary row (36px, pinned to the grid's bottom edge). Each cell reads Add calculation until you pick an aggregation, then shows the result beside its operation name. Plug it into DataTable's per-column summary(rows) slot.
The menu is type-aware, measured from the live app at 180px wide:
| column type | operations |
|---|---|
| any | Count empty · Count filled · Percent empty · Percent filled |
| numeric | …plus Sum · Average · Min · Max |
| both | None, to clear |
Pass numeric for columns that should offer Sum/Average/Min/Max — those operations only apply to number columns.
Installation
npm install @crisp-ui-kit/crispProps
Prop
Type
computeCalc is exported and pure, so the arithmetic is testable without rendering.
Notes
Two behaviours worth knowing:
- Emptiness is not falsiness.
0andfalseare values, not blanks — onlynull,undefined, blank strings and empty arrays count as empty. A column of zeroes reportsCount filled, notCount empty. null, not0, when there is nothing to aggregate.Sumover a column with no numbers renders nothing rather than a misleading0. Counting over an empty set is still a real0.