React Metric Card

A KPI stat tile built for engineering and operations dashboards. Values are set in a monospaced, tabular-numeral face so digits align as data refreshes; trend deltas are signed and color-coded; an optional sparkline shows the recent trajectory with a hover readout. Flat, sharp, and light-background first — the visual language of industrial control software.

Wafer Yield

94.2
%
▲ +1.8%vs last lot

Equipment Uptime

99.97
%
0%30-day rolling

Defect Density

0.12
def/cm²
-8.3%vs baseline

Die Per Wafer

1,482
▲ +2.4%N-1 vs N

Installation

npx shadcn@latest add metric-card.json

Usage

Loading...

Design notes

  • Tabular numerals — the value uses font-mono with tabular-nums so live-updating digits do not shift layout.
  • Signed deltas — positive trends render ▲ +x%, negative render ▼ x%; direction is carried by the glyph as well as color, so state is never encoded by color alone.
  • Sparkline — a 2px line with a subtle area fill. Hovering shows a cursor and the exact sample value; the latest sample is always marked.
  • Restrained hover — the border shifts toward the primary color and corner ticks appear; no shadows, no lift.

Props

PropTypeDefaultDescription
titlestringMetric label, rendered uppercase
valuestringHeadline value (pre-formatted string)
unitstringOptional unit rendered beside the value
trendnumberSigned percentage delta; sign selects color and glyph
trendLabelstringContext for the delta, e.g. "vs last lot"
iconReact.ReactNodeOptional icon shown in the header row
sparklinenumber[]Series rendered as a sparkline with hover readout