cnippet/ui
  1. motion
  2. text animations
  3. animated number

text animations

Animated Number

A spring-animated number that smoothly interpolates to a new value whenever the prop changes. Simpler than SlidingNumber — the entire figure transitions as one unit.

Installation

Usage

Anatomy

Good to know

  • It animates whenever value changes, starting from the previous value. Update value from state.
  • Change the feel with springOptions (Motion spring settings such as stiffness and damping).
  • The displayed number is rounded to a whole number and formatted with toLocaleString() (e.g. 1,234). It can't show decimals.
  • For a one-time count-up from a start number, use CountingNumber.
  • When the user has turned on reduced motion, the number jumps to the new value instead of springing to it.

Props

Examples

Stepper

+10 / −10 buttons update the value. The spring eases through intermediate numbers, making large jumps feel smooth rather than jarring.

Upload Progress

A percentage figure animates alongside a CSS progress bar. Both update from the same state, keeping the animated label in sync with the visual indicator.

Dashboard Metrics

Three KPI cards share a multiplier toggle (1×, 2×, 5×). All three counters spring to their new values simultaneously, giving the dashboard a lively feel on range changes.