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

spark

GraphSpark

A sparkline made of block characters, scaled to the highest value. Write `2 3 5 8 — caption` inside the tag.

use it
Good for a handful of numbers when you don't need an axis.
instead
If you need a y-scale, use Plot.

written

Numbers as children. `0*3` repeats a value. The caption follows an em dash.

[ DEPLOYS ]

three quiet days, then a busy week

Sparkline with 9 points. three quiet days, then a busy week
<GraphSpark title="DEPLOYS">

2 3 0*3 5 8 6 9 — three quiet days, then a busy week

</GraphSpark>

install

command

latency

data can be a string of numbers. The last point is the accent.

[ LATENCY ]

last point is the accent

Sparkline with 12 points. last point is the accent
import { GraphSpark } from "@/registry/default/graph-spark/graph-spark"

<GraphSpark title="LATENCY" data="2 3 4 3 6 5 8 7 9 6 10 8" caption="last point is the accent" />

requests

A quieter series.

[ REQUESTS ]

last twelve deploys

Sparkline with 12 points. last twelve deploys
import { GraphSpark } from "@/registry/default/graph-spark/graph-spark"

<GraphSpark
  title="REQUESTS"
  data={[4, 4, 5, 3, 6, 8, 7, 9, 8, 6, 5, 7]}
  caption="last twelve deploys"
/>
[ PROPS ]
PropTypeDefaultDescription
titlestring—Caption drawn on the top edge of the frame.
datanumber[] | "2 3 4"—Relative values. Scaled to the max. Optional when children are Markdown.
childrenMarkdown—2 3 5 8 13 — last point is the accent
captionstring—Muted line under the sparkline.
glyphs"shade" | "ascii" | "hash" | "bar" | string[]▁▂▃▄▅▆▇█Defaults to spark bars. Pass shade, ascii, hash, bar, or your own characters.
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.