NumberFlow handbook
v2.1.0 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
Animate number changes with digit-by-digit rolling and width transitions while preserving currency, grouping separators, and decimals. Suitable for counters and live metrics.
When to use it
Use NumberFlow for rolling digits. Compare NumericText for other numeric transitions. Use Text for static values without motion.
valueis the number; unparseable strings display as 0.localesandformatcontrol formatting.childrenadd content before or after the number. EnablerespectMotionPreferenceexplicitly to honor the system’s reduced-motion setting.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
Overview and selection boundaries
NumberFlow suits continuous values such as counters, currency, metrics, and clocks. It splits formatted output with Intl.NumberFormat, keeps signs, grouping separators, and decimals, and rolls each digit. Use Text for static numbers; use NumericText, SlotText, or FlowText for character-level rearrangement or other text motion.
Import
Examples
With a prefix, the numerical position is determined by numberPosition:
Accessibility and composition boundaries
The final formatted text remains in the DOM. NumberFlow does not supply an accessible name that explains what the business metric means.
With
respectMotionPreference={true}, reduced motion skips rolling, displacement, and delay and shows the final value immediately.Browsers without CSS custom property registration fall back to number updates without continuous wheel interpolation; the text and formatting remain usable.
childrenonly expresses additional content; numerical splitting, trend, roller track and width measurement are owned by NumberFlow.
NumberFlow style overlay
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
This component source does not directly consume a registered component-specific override. Style composed children through public parts or an explicit child; do not guess variable names.
NumberFlow type and status
Required attribute: value.
Bindable Props: this component declares no named two-way binding; handle state updates through public callbacks or its host.
Inheritance: Omit<FrameProps, "children">. Consult the base class public documentation; fields excluded by Omit cannot be passed through unchanged.
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
TrendResolver
Source: components/src/components/NumberFlow.svelte
TextMotionTrend
Source: components/src/lib/text-motion/types.ts
TextMotionRole
Source: components/src/lib/text-motion/types.ts
NumberFlowTransition
Source: components/src/components/NumberFlow.svelte
RollDirection
Source: components/src/components/NumberFlow.svelte
RenderHints
Source: components/src/logic/frame-types.ts
SkeletonRenderVariant
Source: components/src/logic/frame-types.ts
SnowUIColor
Source: components/src/lib/color.ts
TextMotionAlign
Source: components/src/lib/text-motion/types.ts
TextMotionColor
Source: components/src/lib/text-motion/types.ts
TextMotionColorResolver
Source: components/src/lib/text-motion/types.ts