A tiny inline line for reading a trend in rows
pnpm dlx shadcn@latest add https://notchset.dev/r/sparkline.jsonA trend at a glance: a line, grey in a list until its row is lit.
Every shadcn style · one file
Import it and pass your content. The props that matter most are listed next.
"use client";
import { Sparkline } from "@/components/ui/notchset/sparkline";
/*
* Sparkline twice, at the sizes it lives at, with no card: under its figure, a thin line over its usual band (two
* hairlines), the latest point the one glow and a readout of the week you point at; then in a list, where each row's
* line rests grey and the row you point at takes the series hue. The knobs take the band away and empty it.
*/
const WORDS = {
label: "Sign-ups",
figure: "2,860",
span: "12 weeks",
band: "Usual week: 1,400 to 2,200",
list: "Sign-ups by plan",
weeks: ["10 Aug", "17 Aug", "24 Aug", "31 Aug", "7 Sep", "14 Sep", "21 Sep", "28 Sep", "5 Oct", "12 Oct", "19 Oct", "26 Oct"],
rows: ["Free", "Team", "Business"],
};
const LINE = [1200, 1400, 1300, 1700, 1600, 1900, 2200, 2100, 2400, 2300, 2700, 2860];
const ROWS = [
[820, 900, 860, 1010, 980, 1100, 1240, 1180, 1320, 1290, 1460, 1530],
[300, 340, 310, 420, 400, 470, 560, 540, 620, 580, 720, 760],
[80, 90, 84, 96, 92, 110, 104, 120, 118, 126, 131, 140],
];
export default function SparklineDemo() {
const band = true;
const empty = false;
const w = WORDS;
const fmt = (n: number) => n.toLocaleString("en-US");
return (
<div className="flex w-[340px] max-w-full flex-col gap-8">
<div className="flex min-w-0 flex-col gap-2">
<span className="truncate text-[length:var(--ns-text-small)] text-[var(--ns-ink-2)]">{w.label}</span>
<b className="truncate font-[family-name:var(--ns-font-display)] text-[length:var(--ns-text-large)] leading-none font-[number:var(--ns-weight-strong)] text-[var(--ns-ink)] tabular-nums">{empty ? "—" : w.figure}</b>
<Sparkline className="mt-3 h-10" label={`${w.label}, ${w.span}, rising`} values={empty ? [] : LINE} band={band ? [1400, 2200] : undefined} bandLabel={band ? w.band : undefined} format={fmt} stops={w.weeks} />
<span className="flex justify-between gap-3 text-[length:var(--ns-text-meta)] text-[var(--ns-ink-3)]">
<span className="truncate">{band && !empty ? w.band : ""}</span>
<span className="shrink-0">{w.span}</span>
</span>
</div>
<div role="list" aria-label={w.list} className="flex flex-col">
{w.rows.map((name, i) => (
<div key={name} role="listitem" data-ns-rowhue="" className="grid grid-cols-[1fr_96px_4.5rem] items-center gap-3 rounded-[var(--ns-radius-sm)] px-2 py-2 hover:bg-[var(--ns-hover)]">
<span className="truncate text-[length:var(--ns-text-small)] text-[var(--ns-ink)]">{name}</span>
<Sparkline className="h-6" label={`${name}, ${w.span}`} values={empty ? [] : (ROWS[i] ?? [])} format={fmt} stops={w.weeks} />
<span className="text-end text-[length:var(--ns-text-small)] text-[var(--ns-ink-2)] tabular-nums">{empty ? "—" : fmt(ROWS[i]?.at(-1) ?? 0)}</span>
</div>
))}
</div>
</div>
);
}"use client";
import { Sparkline } from "@/components/ui/notchset/sparkline";
/*
* Sparkline twice, at the sizes it lives at, with no card: under its figure, a thin line over its usual band (two
* hairlines), the latest point the one glow and a readout of the week you point at; then in a list, where each row's
* line rests grey and the row you point at takes the series hue. The knobs take the band away and empty it.
*/
const WORDS = {
label: "Sign-ups",
figure: "2,860",
span: "12 weeks",
band: "Usual week: 1,400 to 2,200",
list: "Sign-ups by plan",
weeks: ["10 Aug", "17 Aug", "24 Aug", "31 Aug", "7 Sep", "14 Sep", "21 Sep", "28 Sep", "5 Oct", "12 Oct", "19 Oct", "26 Oct"],
rows: ["Free", "Team", "Business"],
};
const LINE = [1200, 1400, 1300, 1700, 1600, 1900, 2200, 2100, 2400, 2300, 2700, 2860];
const ROWS = [
[820, 900, 860, 1010, 980, 1100, 1240, 1180, 1320, 1290, 1460, 1530],
[300, 340, 310, 420, 400, 470, 560, 540, 620, 580, 720, 760],
[80, 90, 84, 96, 92, 110, 104, 120, 118, 126, 131, 140],
];
export default function SparklineDemo() {
const band = true;
const empty = false;
const w = WORDS;
const fmt = (n: number) => n.toLocaleString("en-US");
return (
<div className="flex w-[340px] max-w-full flex-col gap-8">
<div className="flex min-w-0 flex-col gap-2">
<span className="truncate text-[length:var(--ns-text-small)] text-[var(--ns-ink-2)]">{w.label}</span>
<b className="truncate font-[family-name:var(--ns-font-display)] text-[length:var(--ns-text-large)] leading-none font-[number:var(--ns-weight-strong)] text-[var(--ns-ink)] tabular-nums">{empty ? "—" : w.figure}</b>
<Sparkline className="mt-3 h-10" label={`${w.label}, ${w.span}, rising`} values={empty ? [] : LINE} band={band ? [1400, 2200] : undefined} bandLabel={band ? w.band : undefined} format={fmt} stops={w.weeks} />
<span className="flex justify-between gap-3 text-[length:var(--ns-text-meta)] text-[var(--ns-ink-3)]">
<span className="truncate">{band && !empty ? w.band : ""}</span>
<span className="shrink-0">{w.span}</span>
</span>
</div>
<div role="list" aria-label={w.list} className="flex flex-col">
{w.rows.map((name, i) => (
<div key={name} role="listitem" data-ns-rowhue="" className="grid grid-cols-[1fr_96px_4.5rem] items-center gap-3 rounded-[var(--ns-radius-sm)] px-2 py-2 hover:bg-[var(--ns-hover)]">
<span className="truncate text-[length:var(--ns-text-small)] text-[var(--ns-ink)]">{name}</span>
<Sparkline className="h-6" label={`${name}, ${w.span}`} values={empty ? [] : (ROWS[i] ?? [])} format={fmt} stops={w.weeks} />
<span className="text-end text-[length:var(--ns-text-small)] text-[var(--ns-ink-2)] tabular-nums">{empty ? "—" : fmt(ROWS[i]?.at(-1) ?? 0)}</span>
</div>
))}
</div>
</div>
);
}components/ui/notchset/sparkline.tsx
LevelMolecule: made of atoms only.
Made ofSpark bars
Free, no account or key. One command for every shadcn style. With the @notchset registry added, @notchset/<name> works too.
Works with React 18.3 or 19 on Tailwind CSS v4, in any shadcn project. What's tested
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
values–
readonly number[]the values, oldest first
label–
stringwhat the trend is, its accessible name
kind"line"
"line" | "bars"line (the default); "bars" draws SparkBars, its own piece for amounts per period
recent1
numberbars: how many of the last periods count as recent (drawn stronger).
staleAfter6
numberbars: this many silent periods at the end turn the bars to the warning colour (gone stale).
band–
readonly [number, number]line: a range [low, high] drawn as a faint band behind the line (the usual range, a target zone).
bandLabel–
stringline: what the band is ("Your usual week"), read after `label`.
formatString
(n: number) => stringline: how the readout writes a value ("62 ms"); plain numbers by default.
stops–
readonly string[]line: what each point is (its day), after the readout's value.
Three usessign-ups each week · a stock's 30 days · a service's error rate
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)v1.0.0 · 2026-11-09
Released free with the Notchset system.