Skip to content
Thrum

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-grid

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Data shape

Type
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)[];
};
Sample
[
  { label: "Revenue", value: 48210, delta: 0.124 },
  { label: "Orders", value: 1284, delta: 0.061 },
]

Props

PropTypeDefaultDescription
itemsreadonly KpiGridItem[]RequiredThe tiles, in reading order. Each one takes what a stat card takes: label, value, format, delta, deltaLabel, goodDirection, trend.
labelstringRequiredWhat the numbers have in common, for example “This week”. Read by screen readers as the name of the group.
localestringDefault "en-US"Locale for every tile that does not set its own.
minTileWidthnumberDefault 160The narrowest a tile may get, in pixels, before the row wraps.
soundbooleanDefault truePlay a soft tone when the values land on new numbers, if the visitor has sound on.
emptyLabelstringDefault "No data"Text shown when there are no tiles.
classNamestring–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

SourcePro

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. 1.0.0 · 2026-12-02First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor