keshon

Sparkline

Dashboards

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>
  );
}

More by keshon

View all
  • List

    List

    4
  • Accordion

    Accordion

  • Turn

    Turn

  • Streaming Text Caret

    Streaming Text Caret

  • Thinking

    Thinking

  • Lanes

    Lanes

  • Key Value List

    Key Value List

  • Status Dot

    Status Dot

More in Dashboards

View all
  • serf dashboard

    serf dashboard

    41
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.6K
  • Glass Dashboard

    Glass Dashboard

    710
  • Adjustable Glass Dashboard

    Adjustable Glass Dashboard

    1.1K
  • Dashboard Shell

    Dashboard Shell

    194
  • Stat Card

    Stat Card

    70
  • Chart Component

    Chart Component

    29
  • App Dashboard Layout

    App Dashboard Layout

    542