Animated numbers where only the changed digits spin, with any Intl format and locale.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
Code
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { NumberFlow } from "@/components/ui/number-flow"
export function NumberFlowDemo() {
const [value, setValue] = React.useState(22)
return (
<div className="flex flex-col items-center gap-6">
<NumberFlow
value={value}
className="text-5xl font-semibold tracking-tight"
/>
<div className="flex flex-wrap justify-center gap-2">
<Button variant="outline" size="sm" onClick={() => setValue(value - 1)}>
−1
</Button>
<Button variant="outline" size="sm" onClick={() => setValue(value + 1)}>
+1
</Button>
<Button
variant="outline"
size="sm"
onClick={() => setValue(value + 111)}
>
+111
</Button>
<Button
variant="outline"
size="sm"
onClick={() => setValue(Math.floor(Math.random() * 100000))}
>
Random
</Button>
</div>
</div>
)
}
































