Number Flow
betaA number whose digits roll to each new value, fading at the window's edges and spinning through rapid updates while its width follows the digits — counters, prices, percentages and compact figures, formatted by Intl.NumberFormat.
- Display
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add number-flownpm packages installed: class-variance-authority.
import { NumberFlow } from "@/components/ui/number-flow";Default
Gallery
Formats
Growing Digits
Countdown
Rapid Updates
Prefix And Suffix
Padding And Grouping
<NumberFlow>
| Prop | Type | Default |
|---|---|---|
value (required)The number to show. Update it as often as you like; each change rolls from what is on screen. | number | — |
asThe element rendered as the root. | NumberFlowElement | "span" |
durationHow long a roll takes, in milliseconds, scaled by the motion scale. Defaults to the slow duration token. Lower it for a value that updates continuously, so the reels stay close to the number. | number | — |
formatIntl.NumberFormat options: | Intl.NumberFormatOptions | — |
localesPassed to Intl.NumberFormat. Defaults to the user's locale. | Intl.LocalesArgument | — |
prefixRendered before the number, outside the reels — a unit, a label, an icon. Never animates. | ReactNode | — |
staggerMilliseconds between one digit starting to roll and the next, from the leading digit. Price Flow uses 50. | number | 0 |
suffixRendered after the number, outside the reels. Never animates, but glides as the width changes. | ReactNode | — |
trendWhich way the reels roll. | NumberFlowTrend | "auto" |
variant | "plain" | "tiles" | "plain" |
Plus every attribute of <span> except children, prefix.
<PriceFlow>
| Prop | Type | Default |
|---|---|---|
value (required)The number to show. Update it as often as you like; each change rolls from what is on screen. | number | — |
asThe element rendered as the root. | NumberFlowElement | — |
durationHow long a roll takes, in milliseconds, scaled by the motion scale. Defaults to the slow duration token. Lower it for a value that updates continuously, so the reels stay close to the number. | number | — |
formatIntl.NumberFormat options: | Intl.NumberFormatOptions | — |
localesPassed to Intl.NumberFormat. Defaults to the user's locale. | Intl.LocalesArgument | — |
prefixRendered before the number, outside the reels — a unit, a label, an icon. Never animates. | ReactNode | — |
staggerMilliseconds between one digit starting to roll and the next, from the leading digit. Price Flow uses 50. | number | 50 |
suffixRendered after the number, outside the reels. Never animates, but glides as the width changes. | ReactNode | — |
trendWhich way the reels roll. | NumberFlowTrend | — |
variant | "plain" | "tiles" | "plain" |
Plus every attribute of <span> except children, prefix.
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes