About
A labeled figure for dashboards that rolls its digits to a new value, shows a trend arrow or percentage, and can draw a hoverable/keyboard-scrubbable sparkline (line or bars) beneath it.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Stat to your project and fits it to your theme.
Code
How Stat is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import Stat from "@/components/ui/stat";
const weeks = Array.from({ length: 8 }, (_, i) => `Week ${i + 1}`);
const averageGrade = [6.9, 7.0, 7.1, 7.3, 7.2, 7.4, 7.5, 7.6];
/** Hovering or dragging across the chart, or tabbing to it and pressing the arrow keys, moves a
* fine mark to the nearest week; the figure and the caption morph into that week's own value and
* name, and morph back once the pointer leaves or the chart loses focus. */
export default function StatDemo() {
return (
<div className="w-80 overflow-hidden rounded-xl border border-[color:var(--color-border)] bg-[var(--color-bg,#f5f5f5)] py-6 dark:bg-[#0a0a0a]">
<Stat
label="Average grade"
value={7.6}
trend={6}
trendTone="positive"
series={averageGrade}
labels={weeks}
description="Out of ten"
foot
/>
</div>
);
}














