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-counterThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
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.
oxyn add animated-counterUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Money
$1,284.50.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Percent
Percent, no decimals.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Tokens
Tokens.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
AnimatedCounter
| Prop | Type | Default | Description |
|---|---|---|---|
valuerequired | f64 | — | Value. |
from | Option<f64> | Default::default() | Previous value (for the roll). |
t | f32 | 1.0 | Roll progress 0..1 (the host animates it). |
label | Option<String> | Default::default() | Small label above. |
prefix | String | Default::default() | Prefix ("$"). |
suffix | String | Default::default() | Suffix ("%"). |
decimals | usize | Default::default() | Decimals. |
size | f32 | 32.0 | Size px. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| — | 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
AnimatedCounterfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
CounterElinoxyn_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.