Skip to content
mdxcn is now part of Shadcn Labs. details

kpi

GraphKpi

One big number with a sparkline underneath. Write `12,400 this week — +18%`, then a line of numbers.

use it
Good when one number is the headline and the rest is context.
instead
Several numbers with no trend is Stat.

written

First line is the value, the label, and `— hint`. The next line is the sparkline.

[ READS ]

12,400

this week

+18%

12,400 this week. +18%
<GraphKpi title="READS">

**12,400** this week — +18%

4 5 5 6 8 7 9 8 11 10 12 14

</GraphKpi>

install

command

reads

The number is the headline. The spark is the last twelve points.

[ READS ]

12,400

this week

+18%

12,400 this week. +18%
import { GraphKpi } from "@/registry/default/graph-kpi/graph-kpi"

<GraphKpi
  title="READS"
  value="12,400"
  label="this week"
  hint="+18%"
  data="4 5 5 6 8 7 9 8 11 10 12 14"
/>

latency

A latency number with a falling series.

[ P95 ]

142ms

read

−18ms

142ms read. −18ms
import { GraphKpi } from "@/registry/default/graph-kpi/graph-kpi"

<GraphKpi
  title="P95"
  value="142ms"
  label="read"
  hint="−18ms"
  data={[8, 7, 9, 6, 5, 7, 4, 5, 3, 4, 3, 2]}
/>
[ PROPS ]
PropTypeDefaultDescription
titlestring—Caption drawn on the top edge of the frame.
valuestring—The large number, already formatted.
labelstring—Line under the number.
hintstring—Optional extra next to the label, like a delta.
datanumber[] | "2 3 4"—Sparkline values. Scaled to the highest point. Optional when children are Markdown.
childrenMarkdown—12,400 this week — +18% 4 5 5 6 8 7 9 value, label, and hint come from the first line.
glyphs"shade" | "ascii" | "hash" | "bar" | string[]—Sparkline characters. Defaults to ▁▂▃▄▅▆▇█.
palette"mono" | "duo" | "multi""mono"mono is one accent plus muted. duo paints the second series with --graph-accent-2. multi cycles three accents.
cornerstring"+"Character at each corner of the frame.
frame"box" | "corners" | "rule" | "none""box"box draws the dashed border. corners keeps only the corner marks. rule draws dashed lines above and below. none drops the border and padding, and puts the title above the content.
classNamestring—Passed to the outer frame.