A swipeable carousel with momentum snapping, a focused center slide and screen reader announcements.
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
import { Carousel } from "@/components/ui/carousel";
export default function Demo() {
return (
<div className="flex min-h-[320px] w-full items-center justify-center p-8">
<Carousel items={[{ label: "One", content: <div className="flex h-full w-full items-end p-4 text-lg font-semibold text-white" style={{ background: "linear-gradient(135deg, #f97316, #8b5cf6)" }}>One</div> }, { label: "Two", content: <div className="flex h-full w-full items-end p-4 text-lg font-semibold text-white" style={{ background: "linear-gradient(135deg, #8b5cf6, #06b6d4)" }}>Two</div> }, { label: "Three", content: <div className="flex h-full w-full items-end p-4 text-lg font-semibold text-white" style={{ background: "linear-gradient(135deg, #06b6d4, #22c55e)" }}>Three</div> }, { label: "Four", content: <div className="flex h-full w-full items-end p-4 text-lg font-semibold text-white" style={{ background: "linear-gradient(135deg, #22c55e, #ec4899)" }}>Four</div> }]} className="w-full max-w-xl" />
</div>
);
}
































