A floating ring that shows how far a page has been read and turns into a back-to-top button at the end.
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.
Code
import { useRef } from "react";
import { ScrollProgressRing } from "@/components/ui/scroll-progress-ring";
export default function Demo() {
const ref = useRef<HTMLDivElement>(null);
return (
<div className="flex min-h-[320px] w-full items-center justify-center p-8">
<div className="relative h-72 w-80">
<div ref={ref} className="h-full overflow-y-auto rounded-2xl border p-5">
{Array.from({ length: 30 }, (_, i) => <p key={i} className="py-2">Scroll me, line {i + 1}</p>)}
</div>
<ScrollProgressRing target={ref} showAfter={0} showPercent />
</div>
</div>
);
}
































