Animated Number
Animated numeric text powered by Number Flow, with the complete Zenos Text styling API.
Animated Number combines Number Flow with Text. Numeric changes roll between values while Zenos supplies typography and semantic colors.
Install
Section titled “Install”pnpm dlx @zentara-co/zenos-cli add animated-numberThe CLI installs @number-flow/react and copies animated-number.tsx into your chosen directory. Import it from your application-owned path:
import { AnimatedNumber } from "./components/animated-number";Changing values
Section titled “Changing values”value belongs to the application. Updating it starts Number Flow’s transition. The first render displays the initial value without an entrance animation.
Formatting and motion
Section titled “Formatting and motion”Set locales explicitly when server and client formatting must agree. format accepts Number Flow’s supported Intl.NumberFormat options. Pass advanced settings, digit rules, plugins, engine styles, events, CSP nonce, or the engine ref through numberFlowProps. Direct formatting props take precedence over the same properties inside numberFlowProps.
Text customization
Section titled “Text customization”All Text props are available: as, type, size, weight, color, align, italic, truncate, maxLines, className, and style, along with native attributes, event handlers, and a root ref. Heading typography chooses the same semantic heading defaults as Text. Use as="span" for inline text or as="output" for a calculated value.
<AnimatedNumber as="span" value={42} size="l" weight="semibold" color="success" align="end" animated={false}/>| Prop | Type | Default | Description |
|---|---|---|---|
value | NumberFlowProps['value'] | — | Required value to display and animate. |
format / locales | NumberFlowProps['format'] / Intl.LocalesArgument | — | Number format and locale selection. |
prefix / suffix | string | — | Optional content before or after the formatted number. |
animated | boolean | true | Disables engine transitions when false. |
numberFlowProps | Number Flow props excluding value and children | — | Advanced engine options, className, style, ref, and animation callbacks. |
Text props / ref | TextProps<C> | — | Typography, polymorphic root semantics, native props, and root ref. |
Accessibility and limits
Section titled “Accessibility and limits”Number Flow handles its animated digits and respects reduced-motion preferences by default. Keep that preference enabled. Add an explicit aria-label when an abbreviated number needs a fuller name. Use aria-live only when changes need announcements, and avoid making rapidly changing counters live regions.
This recipe inherits Number Flow’s limitations: scientific and engineering notation, non-Latin digits, and RTL number formatting are not supported. Text alignment and surrounding RTL layout remain configurable. See the upstream limitations before choosing a locale.