Buttons in every variant and size, with a built-in loading, success and error flow that skips the spinner for fast requests.
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
- @tabler/icons-react
- class-variance-authority
Code
"use client"
import { Button } from "@/components/ui/button"
function wait(ms: number) {
return new Promise<void>((resolve) => setTimeout(resolve, ms))
}
async function fail(ms: number) {
await wait(ms)
throw new Error("Request failed")
}
export function ButtonDemo() {
return (
<div className="flex flex-wrap items-center justify-center gap-2">
<Button feedback onClick={() => wait(900)}>
Save changes
</Button>
<Button feedback variant="outline" onClick={() => fail(900)}>
Request that fails
</Button>
<Button feedback variant="secondary" onClick={() => wait(80)}>
Fast request
</Button>
</div>
)
}
































