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";
/** Eleven nights of run time: the sparkline beside the metric that reports the last of them. */
const runTimeTrend = [58, 61, 54, 57, 49, 52, 47, 50, 45, 44, 42];
export default function SparklineDemo() {
return (
<div className="flex w-full max-w-sm flex-col gap-8 bg-background p-8 text-foreground">
<div className="flex flex-col gap-2">
<span className="text-sm text-muted-foreground">values</span>
<Sparkline
values={runTimeTrend}
locale="en-GB"
className="text-primary"
/>
</div>
<div className="flex flex-col gap-2">
<span className="text-sm text-muted-foreground">area</span>
<Sparkline
values={runTimeTrend}
area
locale="en-GB"
className="text-primary"
/>
</div>
<div className="flex flex-col gap-2">
<span className="text-sm text-muted-foreground">last={"{false}"}</span>
<Sparkline
values={runTimeTrend}
last={false}
locale="en-GB"
className="text-primary"
/>
</div>
</div>
);
}








