Display

Counter

Animated number display. Use odometer mode for rolling-digit motion (mechanical counter look) or tween mode for an eased count-up from the previous value.

Installation

import { WrCounter, WrCountUp } from 'ngwr/counter';

@Component({ imports: [WrCounter, WrCountUp] })
export class MyComponent {}

Odometer

Digits roll vertically. Reacts to any value change.

<wr-counter [value]="123456" mode="odometer" />
123,456Randomize

Tween

Eased single interpolation. Good for monetary values.

<wr-counter [value]="9.99" mode="tween" [decimals]="2" prefix="$" />
$420.69Randomize

Padded integer

Force a minimum number of integer digits.

<wr-counter [value]="42" [minIntegerDigits]="6" mode="odometer" />
000,000Step

Count up — spring + viewport trigger

<wr-count-up> is the spring-physics sibling. Use it when you want viewport-triggered animation, started/completed outputs, or count-down.

<wr-count-up [to]="1000" easing="spring" trigger="visible" />
1,000

Count down

Swap direction without rewriting from / to.

<wr-count-up [from]="60" [to]="0" direction="down" />
60

Counter API

NameDescriptionTypeDefault
valuerequiredThe number to show. Coerced like every other numeric input here — it was the only one without it, and Intl.NumberFormat().format(NaN) renders the literal text NaN.number
modeAnimation mode.WrCounterMode'odometer'
durationDuration (ms).number900
decimalsFixed number of decimals.number0
prefixOptional prefix (e.g. '$').string''
suffixOptional suffix (e.g. '%').string''
groupingGroup thousands.booleantrue
minIntegerDigitsPad integer part to at least this many digits.number0 (no padding)

Count-up API

NameDescriptionTypeDefault
fromStarting value.number0
torequiredTarget value.number
durationAnimation duration. Units depend on easing: - ease-out — milliseconds (default 1200, min 100) - spring — seconds (tunes spring stiffness; default 2)number1200
delayOptional delay (ms) before the animation starts.number0
easingAnimation curve.WrCountUpEasing'ease-out'
triggerWhen to start the animation. - 'mount' (default) — start as soon as the component is rendered. - 'visible' — wait for the host to enter the viewport (IntersectionObserver). Useful for long pages or hero numbers below the fold.WrCountUpTrigger'mount'
directionCounting direction. 'down' swaps fromto.WrCountUpDirection'up'
decimalsFixed number of decimals.number0
prefixOptional prefix (e.g. '$').string''
suffixOptional suffix (e.g. '%').string''
groupingDisable grouping separators (1,2341234).booleantrue (grouping on)
(started)Emits when the animation begins.void
(completed)Emits when the animation settles.void