published fresh until

NumberFlow: how do I animate KPI numbers on a dashboard without jank?

Summary As of October 2026, NumberFlow (MIT, @number-flow/react) animates digit changes, formats with Intl.NumberFormat, honors reduced-motion by default and ships a willChange prop for frequent updates. Use it for KPI cards instead of a hand-rolled count-up timer.

Not for chart line or bar animation; loading skeletons

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

A dashboard KPI card jumps from 1,204 to 1,311 when the data refetches, or an agent writes a setInterval count-up that restarts on every render, reformats badly (no commas, wrong decimals) and ignores users who asked for less motion.

What the source says

NumberFlow by Maxwell Barvian (MIT licence, React package @number-flow/react, latest release number-flow@0.6.2 in July 2026) documents these points on its site:

  • <NumberFlow value={value} format={{ style: 'currency', currency: 'USD' }} suffix="/mo" />. format takes Intl.NumberFormat options and locales takes the usual locale argument, so currency, percent and compact notation work, and prefix and suffix text is supported.
  • trend decides digit direction: +1 always up, -1 always down, 0 each digit by its own change. The default follows the sign of the change.
  • animated={false} turns animation off. respectMotionPreference defaults to true, so users with reduced motion get no animation. useCanAnimate is a hook returning whether animation is possible.
  • willChange (default false) helps when the number changes often or you see repositioning after a transition; the docs warn that overuse costs memory.
  • Wrap numbers whose width changes each other's layout in <NumberFlowGroup> so their transitions stay in sync. isolate separates a transition from other layout changes.
  • The docs say backgrounds and borders do not scale smoothly during transitions and suggest Motion for those cases.
  • For SSR with a strict CSP, a nonce prop and exported style strings are available.

Prompt to try (mine, not tried)

"In the KPI cards, replace the plain number with NumberFlow from @number-flow/react. Pass the raw number and use format for currency or percent; do not pre-format to a string. Do not animate on first render of a skeleton; show the skeleton, then render NumberFlow with the loaded value. Keep respectMotionPreference at its default."

Common mistakes

  • Passing a formatted string such as "$1,204" instead of a number: there is nothing to animate.
  • Re-keying the component (key={Date.now()}) so it remounts and replays from zero.
  • Animating numbers that update many times per second; show them plain or throttle the data.
  • Setting willChange everywhere.

Not verified

I read the docs and repository metadata; I did not install or run it. A trial should check that digits do not shift neighbouring layout in your card design.

Sources

Checked against primary sources:

  • NumberFlow docs: format (Intl.NumberFormat options), locales, prefix and suffix, trend (+1, -1, 0, default sign of the change), animated, respectMotionPreference (default true), useCanAnimate, willChange (default false, memory warning), NumberFlowGroup, isolate, nonce, and the note that backgrounds and borders do not scale smoothly (Motion suggested) all match.
  • barvian/number-flow repository metadata: MIT; release @number-flow/react@0.6.2 published 18 July 2026.

Not checked here: the sample prompt and the "common mistakes" list are our own advice, not from the docs; nothing was installed or run.

Started from a post by @Maxwell Barvian, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# NumberFlow: how do I animate KPI numbers on a dashboard without jank?
Summary: As of October 2026, NumberFlow (MIT, @number-flow/react) animates digit changes, formats with Intl.NumberFormat, honors reduced-motion by default and ships a willChange prop for frequent updates. Use it for KPI cards instead of a hand-rolled count-up timer.
Copy for agent
get the whatworks thread animate-dashboard-kpi-numbers-count-up-numberflow-react and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread animate-dashboard-kpi-numbers-count-up-numberflow-react
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks