Skip to content
StackD
Live stat card, the StackD component

Cards · Free

Live stat card

A number that counts up, a sparkline and a tooltip.

Free on Gumroad: the download arrives in your inbox.

Details

Category
Cards
Plan
Free
Code
React + Tailwind, TypeScript · 296 lines
Files
StatCard.tsx
Needs
React and Tailwind only
Agents
MCP server and shadcn registry

About

A stat card for dashboards. The number counts up and a smooth line draws itself in. Run along the line (mouse, touch or arrow keys) and the number follows you. In live mode a new point arrives every few seconds: the old line flows into the new one while the number and the change count across, so they land together. White and black versions. React + Tailwind, no other libraries. Respects reduced motion.

Install

With the shadcn CLI:

npx shadcn@latest add https://www.stackd.codes/r/stat-card.json

Or let your agent add it through the StackD MCP server:

claude mcp add --transport http stackd https://www.stackd.codes/mcp

Prompt for your agent

Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.

Add the StackD Live stat card component to this project. Use the StackD MCP server: call get_component with { "name": "stat-card" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles.

Use

  1. Copy StatCard.tsx into your project (for example components/StatCard.tsx).
  2. Use it:
import { StatCard } from './components/StatCard'

const points = [
  { label: 'Nov 1', value: 4210 },
  { label: 'Nov 2', value: 4380 },
  // ...
]

<StatCard label="Revenue" data={points} />
<StatCard label="Revenue" data={points} theme="dark" color="#C9B8FF" />

For live data, give live a function that returns the next point:

<StatCard
  data={points}
  live={() => fetch('/api/revenue/latest').then((r) => r.json())}
  every={5}
/>

live={true} makes up demo points, handy for a preview.

In Next.js the file already starts with 'use client'. In other React setups that line does nothing.

Options

PropDefaultWhat it does
label'Revenue'The title at the top
datademo points{ label, value }[], oldest first
formateuros, no decimals(n) => string, how the number is written
theme'light''light' (white card) or 'dark' (black card)
colorink on light, white on darkLine colour, any CSS colour
livefalsetrue for demo points, or a function that returns the next point
every3Seconds between live points

The change badge shows the change from the first point: up in olive, down in wine. The card keeps the last 14 points in live mode.

Colours from StackD

White #FFFFFF · Ink #141310 · Wine #901919 · Olive #6C8544 · Ochre #BE9344 · Lilac #C9B8FF

Licence

You can use it in personal and commercial projects. Don't resell or share the component on its own.

Made by StackD · stackd.codes