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 SparklineBesideMetricDemo() {
return (
<div className="flex w-full max-w-sm flex-col gap-1 bg-background p-8 text-foreground">
<span className="text-sm text-muted-foreground">Run time</span>
<div className="flex items-baseline gap-2">
<span className="text-3xl font-semibold tracking-tight">42s</span>
<span className="text-sm text-primary">18% faster than the last</span>
</div>
{/* describe={false}: the numbers already stand beside it in text, so the picture carries no name of its own. */}
<Sparkline
values={runTimeTrend}
area
describe={false}
className="mt-3 text-primary"
/>
</div>
);
}
















