Components
Counter
Animated number that counts between two values as the user scrolls.
Overview
<Counter> animates a number between two values as the user scrolls. Automatically reads progress from a parent <Scene>, or accepts a progress prop directly.
Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
from | number | -- | Starting value |
to | number | -- | Ending value |
at | number | 0 | Progress value (0-1) when counting begins |
span | number | 0.3 | How much of the progress range (0-1) the count spans |
format | (value: number) => string | toLocaleString | Formatting function for the displayed value |
easing | string | (t: number) => number | "ease-out" | Easing preset name or custom easing function |
progress | number | -- | Direct progress override (0-1). If omitted, reads from parent <Scene> context |
className | string | -- | CSS class for the <span> element |
When both from and to are integers, the displayed value is automatically rounded.
Accessibility
When prefers-reduced-motion is enabled, the counter displays the final to value immediately once progress reaches the at threshold.