KPI grid
The row of headline numbers at the top of a dashboard, as one panel. Use it when three to six figures belong together; the tiles share hairlines instead of standing as separate cards. For a single figure, use the stat card.
Install
npx shadcn@latest add @thrum-pro/kpi-gridThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Data shape
type KpiGridItem = {
label: string;
value: number;
format?: Intl.NumberFormatOptions;
delta?: number; // a fraction: 0.124 is +12.4%
deltaLabel?: string;
goodDirection?: "up" | "down";
trend?: readonly (number | null)[];
};[
{ label: "Revenue", value: 48210, delta: 0.124 },
{ label: "Orders", value: 1284, delta: 0.061 },
]Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | readonly KpiGridItem[] | Required | The tiles, in reading order. Each one takes what a stat card takes: label, value, format, delta, deltaLabel, goodDirection, trend. |
label | string | Required | What the numbers have in common, for example “This week”. Read by screen readers as the name of the group. |
locale | string | Default "en-US" | Locale for every tile that does not set its own. |
minTileWidth | number | Default 160 | The narrowest a tile may get, in pixels, before the row wraps. |
sound | boolean | Default true | Play a soft tone when the values land on new numbers, if the visitor has sound on. |
emptyLabel | string | Default "No data" | Text shown when there are no tiles. |
className | string | – | Sets the size. The grid fills the width it is given. |
Motion and sound
Motion
- First draw: each trend line is revealed left to right. The numbers appear at once.
- New values roll from the numbers on screen, all together, in about 400 ms with no overshoot.
- Tiles keep their size while numbers roll, so the hairlines between them never move.
- Reduced motion: everything appears complete and changes instantly.
Sound
- A short tone when the values land after a change. All the tiles change together, so it plays once, not once per tile.
Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works
Accessibility
- The panel is a group named by its label, and each tile is a group named by its own label.
- Tiles are read in the order given: label, value, signed change, trend summary.
- The row wraps by width, never by a screen-size breakpoint, so it reads the same in a sidebar and across a page.
- Nothing in the grid takes focus: there is nothing to operate.
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/kpi-grid.tsx- Packages
- None
- Brings along
- Stat card
Changelog
- 1.0.0 · 2026-12-02First release.