Sparkline, Sparkbars

Fiddle
A tiny trend beside a headline number: a line for a series, bars for counts per period.

Usage

The import, then a use to start from. Both copy as they are.

Import
import { Sparkbars } from "@/components/ui/Sparkbars";import { Sparkline } from "@/components/ui/Sparkline";
Example
<Sparkline values={[3, 5, 4, 8, 12]} className="h-8 w-24" /><Sparkbars values={[0, 2, 1, 4]} className="h-8 w-24" />

When to use

Use it for

  • A trend beside a headline number on a card: Sparkline for a series, Sparkbars for counts per period.
  • Both stretch to their box, so size them with className. Nothing renders without a value.

Avoid

  • Axes, tooltips or a legend: the full chart belongs on an analytics view.

Accessibility

Checks

  • Decorative: the headline number beside it states the value.

API

Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.

Sparkline

Its stories don't declare argTypes, so no props are listed. The variants show its states.
VariantsDefaultDownloadsFlat

Sparkbars

Its stories don't declare argTypes, so no props are listed. The variants show its states.
VariantsDefaultBusySparse

Keep going