A card component that displays numbers with smooth flip animations.
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
- motion
Code
"use client";
import { useState } from "react";
import AnimatedNumberFlip from "@/registry/ruixenui/animated-number-flip";
import { Button } from "@/components/ui/button";
export default function Demo() {
const [page, setPage] = useState(1);
return (
<div className="flex flex-col items-center gap-6 py-20">
<AnimatedNumberFlip value={page} />
<div className="flex gap-4">
<Button onClick={() => setPage((p) => Math.max(1, p - 1))}>Prev</Button>
<Button onClick={() => setPage((p) => p + 1)}>Next</Button>
</div>
</div>
);
}
































