Installation
Theme
Mode

Data viz

Sparkline

A word-sized chart — trend at a glance, no axes, no chrome. Made to live inside a table cell, a stat card, or a sentence. Drawn as plain inline SVG so dozens render instantly with zero load.

$npx shadcn@latest add @orbit/sparkline

Overview

Word-sized: a headline number gets its recent history without a second line of space.

Word-sized
Velocity · 12 wk
3118%

Variants

Line for a pure trend, area to emphasize volume, bars for discrete periods, and win/loss for binary streaks like passing builds.

Line
variant="line"
Area
variant="area"
Bar
variant="bar"
Win / loss
variant="winloss"

Color

Pick a palette color to match a series, or let color="trend" resolve success or danger from the first-to-last direction.

Accentcolor="accent"
Trend · upcolor="trend"
Trend · downcolor="trend"
Tealcolor="teal"

In a table

Their best home: one micro-chart per row turns a wall of numbers into a scannable shape.

ProjectTasksΔ12-wk trend
Orbit redesignORB
24812%
Mobile appMOB
1866%
Billing v2BIL
928%
Data platformDAT
1543%

In stat cards

A sparkline gives a headline number its recent history without taking a second line of space.

Throughput
4118%
Cycle time
2.4d11%
Open bugs
175%

Props

PropTypeDefaultDescription
datanumber[]The series. A sparkline is always single-series — no legend, no axes.
variant"line" | "area" | "bar" | "winloss""line"Chart shape. winloss draws ± bars around a midline and ignores color.
color"accent" | "trend" | "violet" | "teal" | string"accent"accent = var(--pri); trend resolves success (up) or danger (down) from first vs. last; or pass any token / color-mix string.
widthnumber120Fixed width in px.
heightnumber32Fixed height in px.
showDotbooleantrueSurface-cored dot on the last point (line and area).
strokeWidthnumber1.75Line stroke width.
ariaLabelstringPlain-language summary for the svg's role=“img”. Defaults to a generated trend sentence.
…restHTMLAttributes<HTMLSpanElement>Forwarded to the root span, including ref and className.

Usage

A sparkline shows shape, not precise values — pair it with the number it summarizes.

Do

Pair with the number

The sparkline gives shape; the adjacent value gives the magnitude. Always show both.

Don’t

Add axes or labels

Gridlines and ticks defeat the purpose — if you need to read exact values, use a full chart.

Do

Keep a consistent size

In a column, every sparkline should share width and height so rows compare honestly.

Don’t

Cram in too many points

Past ~30 points the shape turns to noise at this size — aggregate to weeks or sprints.

Keyboard & accessibility

The sparkline renders as a labelled image; the adjacent number carries the exact value.

roleimg with a text summary
aria-label“Trend up 18% over 12 weeks”
ColorNever the only signal — pair value
AdjacentExact number sits beside it