text animations
Counting Number
Smoothly animates from a start value to a target number using a spring or tween. Supports imperative replay via a ref and fires start/complete callbacks.
Installation
Usage
Anatomy
Good to know
- It counts from
from(default0) totargetonce, when it mounts. - Set
autoStart={false}and callref.current.startAnimation()to start it yourself, for example when it scrolls into view. onStartandonCompletefire at the beginning and end of the count.- For a number that changes over time, use
AnimatedNumberorSlidingNumber. - When the user has turned on reduced motion, it shows
targetstraight away;onStartandonCompletestill fire.
Props
Ref API
Pass a ref to access startAnimation() imperatively:
Examples
Stats Section
Four CountingNumber components animate a social-proof grid on mount. Values use toLocaleString formatting automatically.
Large Hero Metric
A single full-width counter dominates the hero section with a large typographic treatment. A replay button calls ref.current.startAnimation() to re-run the count.
Dashboard Metrics
Three counters inside bordered cards with gradient text colours. Different duration values create a staggered feel without any extra wrapper logic.