Skip to content
Back

Animated counterPro

A total that moves clearly: a label, prefix and suffix, fixed decimals and thousands separators, each digit column rolling the direction the number moved with a slight stagger.

oxyn add animated-counter
Run cost
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • A changing total with a clear sense of movement: a small label, prefix and suffix, fixed decimals and thousands separators; each digit column rolls in the direction the whole number moved with a slight stagger, columns that do not change stay still.

When not to use

  • A launch countdown with digits that roll per unit, a compact one-line variant, hours absorbing days when days are hidden, and a live state with a pulsing dot at zero: use Countdown instead.
  • A collapsible JSON tree with search, paging for long arrays, copy value or path, the current path under the tree and full keyboard moves: use JSON viewer instead.
  • A word-level diff for prose: use Inline Diff instead.

Installation

Animated counter is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add animated-counter

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Money

$1,284.50.

Run cost
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Percent

Percent, no decimals.

Run cost
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Tokens

Tokens.

Run cost
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

AnimatedCounter

PropTypeDefaultDescription
valuerequiredf64—Value.
fromOption<f64>Default::default()Previous value (for the roll).
tf321.0Roll progress 0..1 (the host animates it).
labelOption<String>Default::default()Small label above.
prefixStringDefault::default()Prefix ("$").
suffixStringDefault::default()Suffix ("%").
decimalsusizeDefault::default()Decimals.
sizef3232.0Size px.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
—Not interactive

Accessibility

  • The whole value is the accessible name (role=img); rolling digits are aria-hidden.
From the spec
  • The full value is the accessible name; digits are aria-hidden.

Motion & interaction

Timing
  • Reduced motion: no entrance rise, no shimmer (static muted text), rings and bars jump to their value.

Responsive behaviour

  • Font size is a prop.
Edge cases (spec)
  • Size is a prop.

Notes for AI

  • Import AnimatedCounter from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: CounterEl in oxyn_gpui.
  • Props to set first: value.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI