A bar or ring that shows how far a task has come, eases between updates and slides while the total is unknown.
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
- @base-ui/react
- class-variance-authority
Code
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import {
Progress,
ProgressLabel,
ProgressValue,
} from "@/components/ui/progress"
export function ProgressDemo() {
const [value, setValue] = React.useState<number | null>(null)
const [run, setRun] = React.useState(0)
React.useEffect(() => {
let current = 0
let tick: ReturnType<typeof setInterval> | undefined
const start = setTimeout(() => {
setValue(0)
tick = setInterval(() => {
current = Math.min(100, current + Math.round(Math.random() * 12 + 3))
setValue(current)
if (current === 100) {
clearInterval(tick)
}
}, 400)
}, 1200)
return () => {
clearTimeout(start)
clearInterval(tick)
}
}, [run])
const label =
value === null ? "Preparing…" : value === 100 ? "Uploaded" : "Uploading"
return (
<div className="flex w-full max-w-sm flex-col items-center gap-6">
<Progress value={value}>
<ProgressLabel>{label}</ProgressLabel>
<ProgressValue />
</Progress>
<Button
variant="outline"
size="sm"
onClick={() => {
setValue(null)
setRun(run + 1)
}}
>
Restart
</Button>
</div>
)
}
































