Skip to content

CountUp

Numbers that count — eased value animation with tabular figures, prefixes and suffixes.

Live — this one is real

259

Pieces in the archive

128+

States per component

100%

Reduced-motion safe

Usage

tsx
import { CountUp } from "mizu-ui";

export function Stat() {
  return <CountUp value={1284} duration={1.4} suffix="+" />;
}

Source & setup

Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with its source module’s stylesheet and base.css, Mizu’s tokens. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.

sh
npx shadcn@latest add 0xuser64bit/mizu/count-up

Every component imports from its own path, its name in kebab case.

tsx
import { CountUp } from "@/components/ui/mizu/count-up";

For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Requires React and Motion. A Client Component: its source starts with “use client”.

Inspect feedback/CountUp.tsx

Source is included in the npm package under src/feedback/CountUp.tsx.

Open full source ↗

Props

PropTypeDefaultDescription
valuenumber—Target value. Animates from the previous value on change.
durationnumber1.2Animation duration in seconds.
delaynumber0Start delay in seconds.
decimalsnumber0Fraction digits, clamped to 0–20.
prefix / suffixstring""Affixes rendered outside the animation.

Accessibility

The final value is separate screen-reader text; the changing visual figures are aria-hidden. Reduced motion renders the final number directly.

Motion

Quartic ease-out on a rAF loop. Reduced motion sets the value instantly.

Works alongside