Skip to main content

useAnimatedNumber Hook

A React hook that animates numeric values from 0 to their target on mount. Parses prefixes/suffixes ($, %, commas) and preserves formatting during animation. Uses motion's animate() with reduced motion support.

Installation

$ npx shadcn@latest add @orecus/use-animated-number
Dependencies:
motion
Registry:
@orecus/use-reduced-motion

Usage