Sparkline
Inline trend, one-shot draw.
npx shadcn add @lopifi/sparklineExamples
The same component, case by case. Each stage is the shipped code with the props it shows; switch to Code for the usage.
Polarity
A falling burn line is good news; the same shape under standard polarity would paint it red.
Beside its figure
A sparkline is shape without scale, so it sits next to the number it summarizes and never replaces it.
How it behaves
What it renders, what it refuses to render, and why. The same paragraphs as the family spec, so the two can’t disagree.
24–40px tall, no axes, no gridlines, no tooltip by default. --text-secondary stroke at 1.5px, or --positive/--negative by net direction, or neutral when polarity="neutral". polarity is required with no default, because a falling burn line is good news.
Optional endpoint dot and a single label at the last point.
Motion: stroke-dashoffset draw, 600ms --ease-out, once, on first paint or scroll-into-view ({ once: true }). Never on data change.
Touch: no scrub. A sparkline gives an impression. If the user needs values, use MoneyChart.
More in Primitives
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section Sparkline renders in, the calculators behind its figures, and the ledger payloads that feed it.
Components are copied into your repository and meant to be edited. Rounding policy, fiscal calendar and compliance copy differ per company.
Release notes
Get an email when Primitives changes
Your copy doesn’t update itself when we fix something here.
- One email when a Primitives component needs a migration
- Nothing when nothing changes
Or install it now