About
An inline SVG mini chart that draws the shape of a trend (line, optional area fill, and a dot on the last value) from a short series of numbers, used beside a metric or in a table row.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Sparkline to your project and fits it to your theme.
Code
How Sparkline is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { Sparkline } from "@/components/ui/sparkline";
/** The same run's warnings, climbing; and its shards, level. */
const warningTrend = [4, 5, 5, 6, 5, 7, 8, 8, 9, 11, 12];
const runTimeTrend = [58, 61, 54, 57, 49, 52, 47, 50, 45, 44, 42];
const shardTrend = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6];
export default function SparklineTrendReadingsDemo() {
return (
<div className="flex w-full max-w-sm flex-col gap-6 bg-background p-8 text-foreground">
<div className="flex flex-col gap-2">
<span className="text-sm text-muted-foreground">
Warnings: 12, up from 4
</span>
<Sparkline
values={warningTrend}
label="Warnings: 12, up from 4"
className="text-destructive"
/>
</div>
<div className="flex flex-col gap-2">
<span className="text-sm text-muted-foreground">
Run time: 42 s, down from 58 s
</span>
<Sparkline
values={runTimeTrend}
label="Run time: 42 s, down from 58 s"
className="text-primary"
/>
</div>
<div className="flex flex-col gap-2">
<span className="text-sm text-muted-foreground">Shards: 6, level</span>
<Sparkline
values={shardTrend}
label="Shards: 6, level"
className="text-muted-foreground"
/>
</div>
</div>
);
}








