Skip to content
pandacoderz/ui

Mini Chart

Dependency-free sparkline, bar chart, and stat tile for usage dashboards and inline metrics.

Requests
4.8k+12%
Tokens (M)
6.4+5%
Spend by model ($)
$165
$48
$31
$64
$22
FableOpusSonnetHaiku

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/mini-chart.json

Usage

import { BarChart, Sparkline, StatTile } from "@/components/pandacoderz-ui/mini-chart";
<StatTile label="Requests" value="4.8k" delta="+12%" deltaTone="up" chart={<Sparkline data={series} />} />
<BarChart data={[{ label: "Opus", value: 31 }, { label: "Sonnet", value: 64 }]} height={80} />

Colors come from currentColor, so className="text-chart-2" recolors a sparkline. These are deliberately small; move to a charting library once you need axes or tooltips.

API Reference

Sparkline

Prop Type Description
data number[] Series.
area boolean Gradient fill under the line. Default true.
dot boolean Mark the last point. Default true.

BarChart

Prop Type Description
data { label, value, color? }[] Bars.
height number Px. Default 120.
showValues boolean Reveal values on hover.

StatTile

Prop Type Description
label / value ReactNode Headline pair.
delta / deltaTone ReactNode / "up" | "down" | "neutral" Trailing change text.
chart ReactNode Rendered under the value.