Skip to content
HomeCobalt

Sparkline

Draws the trend of a series as a line with no axes, in a table cell or beside a figure, as a picture with a name.

Examples

Twelve months of assets beside the latest figure.
$4.7B
In a tableA sparkline in each row of a table of advisers, beside the latest figure it ends on.
AdviserAssetsLast 12 months
Northwind Capital$4.7B
Harbor Point Advisors$2.1B
Juniper Partners$880M

Usage

Use it when

  • A trend at a glance in a table cell, such as assets for the last 12 months in each row of a table of advisers.
  • A trend beside a headline figure that already says the number.

Use something else when

  • A trend a person reads by value, with axes and a tooltip. Use LineChart instead.
  • One figure and its change, with no history worth a picture. Use Stat instead.
  • A share of a fixed limit. Use Meter instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/sparkline.json
import { Sparkline } from "@/components/cobalt/ui/sparkline"