Ballmac UI home

Sparkline

A lightweight accessible SVG trend line with a marked latest value and no chart dependency.

Weekly signups

1,208

Up this week

Installation

$ pnpm dlx shadcn@latest add @ballmac/sparkline

Usage

import { Sparkline } from "@/components/ballmac/sparkline"

The full example is in the Code tab above.

Examples

States and variants

API reference

PropTypeDefault
values*

Ordered numeric samples.

number[]—
label*

Accessible description of the series.

string—
height

Height in pixels.

number48
showEnd

Show the last data point.

booleantrue

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
NoneTrend description is announced as an image

Use with AI

A lightweight accessible SVG trend line with a marked latest value and no chart dependency. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Sparkline (@ballmac/sparkline) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Show a small trend beside a metric

Not for

  • Use a full chart for axes and detailed inspection

Registry JSON: https://ui.ballmac.com/r/sparkline.json

Credits

Free to use in personal and commercial projects.

npm
None