A countdown banner with Fluid Numerals — odometer-style rolling digits, colon heartbeat, and height-collapse dismiss.
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
- lucide-react
Code
"use client";
import { useState, useMemo, useCallback } from "react";
import { BannerCountdown } from "@/registry/ruixenui/banner-countdown";
import { RotateCcw } from "lucide-react";
export default function BannerCountdownDemo() {
const [key, setKey] = useState(0);
const [dismissed, setDismissed] = useState(false);
// 2 hours from mount — rolling is visible every second
const endDate = useMemo(
() => new Date(Date.now() + 2 * 60 * 60 * 1000),
// eslint-disable-next-line react-hooks/exhaustive-deps
[key],
);
const replay = useCallback(() => {
setKey((k) => k + 1);
setDismissed(false);
}, []);
return (
<div className="flex min-h-[300px] w-full flex-col">
<div className="w-full">
<BannerCountdown
key={key}
title="Flash Sale ends in"
endDate={endDate}
action={{ label: "Shop now", href: "#" }}
onDismiss={() => setDismissed(true)}
/>
</div>
<div
className={`flex flex-1 items-center justify-center transition-opacity duration-300 ${
dismissed ? "opacity-100" : "pointer-events-none opacity-0"
}`}
>
<button
onClick={replay}
className="inline-flex items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground"
>
<RotateCcw className="size-3.5" />
Replay
</button>
</div>
</div>
);
}
































