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.
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.
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.
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]}
/>| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | — | Caption drawn on the top edge of the frame. |
| value | string | — | The large number, already formatted. |
| label | string | — | Line under the number. |
| hint | string | — | Optional extra next to the label, like a delta. |
| data | number[] | "2 3 4" | — | Sparkline values. Scaled to the highest point. Optional when children are Markdown. |
| children | Markdown | — | 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. |
| corner | string | "+" | 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. |
| className | string | — | Passed to the outer frame. |