A large total whose digits roll ones-first, the last increment rolling under it, and a strip of recent increments as lollipops with the newest hollow.
pnpm dlx shadcn@latest add https://beautiful-ui.dev/r/animated-counter.jsonpnpm dlx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/animated-counter.jsonFree, no account or key. Use the command for your project's primitives: a radix-*, new-york or default style in components.json is Radix, a base-* style is Base UI. With the @beautiful-ui registry added, @beautiful-ui/<name> picks for you.
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { AnimatedCounter } from "@/components/ui/notchset/animated-counter";
/** Total runs, rolling as new ones land. */
export function RunCounter() {
const [runs, setRuns] = React.useState(2_486_120);
const [last, setLast] = React.useState(0);
React.useEffect(() => {
const iv = setInterval(() => {
const n = 20 + Math.round(Math.random() * 180);
setLast(n);
setRuns((r) => r + n);
}, 2000);
return () => clearInterval(iv);
}, []);
return <AnimatedCounter value={runs} last={last} />;
}value–
numberThe total.
last–
numberThe latest increment.
IncrementStrip values–
number[]Recent increments.
components/ui/notchset/animated-counter.tsx