noahgdev

Sparkline

Dashboards

About

A tiny inline area or line chart with no axes, for showing a trend next to a number. It is what the KPI card and metric list use, and it is small enough to drop into a table cell.

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/dashboardcn-sparkline"

const data = [12, 18, 14, 22, 26, 21, 30, 34, 28, 40, 44, 52]

export default function SparklineDemo() {
  return (
    <div className="grid w-full max-w-md gap-6">
      <div className="flex flex-col gap-1.5">
        <span className="text-muted-foreground text-xs">Area</span>
        <Sparkline data={data} className="h-12" />
      </div>
      <div className="flex flex-col gap-1.5">
        <span className="text-muted-foreground text-xs">Line</span>
        <Sparkline data={data} variant="line" className="h-12" />
      </div>
      <div className="flex flex-col gap-1.5">
        <span className="text-muted-foreground text-xs">Dot grid</span>
        <Sparkline data={data} fill="dots" color="var(--chart-1)" className="h-12" />
      </div>
      <div className="flex flex-col gap-1.5">
        <span className="text-muted-foreground text-xs">Custom color, step curve</span>
        <Sparkline
          data={data}
          curve="step"
          color="var(--chart-2)"
          className="h-12"
        />
      </div>
    </div>
  )
}

Dependencies

More by noahgdev

View all
  • Donut Chart

    Donut Chart

    1
  • Metric List

    Metric List

  • Sankey Chart

    Sankey Chart

  • Scatter Chart

    Scatter Chart

  • Radar Chart

    Radar Chart

  • Composed Chart

    Composed Chart

  • Bar Chart

    Bar Chart

  • Funnel Chart

    Funnel Chart

More in Dashboards

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    659
  • Analytics Dashboard

    Analytics Dashboard

    59
  • Creator Dashboard

    Creator Dashboard

    208
  • Insights Dashboard

    Insights Dashboard

    35
  • serf dashboard

    serf dashboard

    137
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    293
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.7K
  • Business/Sales Dashboard

    Business/Sales Dashboard

    1.5K