A canvas-based pseudo-3D particle field with perspective projection, continuous rotation and buoyant drift.
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
"use client"
import { ArrowRight } from "lucide-react"
import { useTheme } from "next-themes"
import { Floating3DParticles } from "@/registry/magicui/floating-3d-particles"
export default function Component() {
const { resolvedTheme } = useTheme()
const color = resolvedTheme === "dark" ? "#ffffff" : "#000000"
return (
<div className="bg-background relative flex h-[500px] w-full items-center justify-center overflow-hidden rounded-lg border">
<Floating3DParticles color={color} />
<div className="relative z-10 flex flex-col items-center gap-6 px-6 text-center">
<h2 className="text-3xl font-bold tracking-tight md:text-5xl">
Build something magical
</h2>
<p className="text-muted-foreground max-w-xl text-base md:text-lg">
A pseudo-3D particle background that stays behind your content with
continuous rotation and buoyant drift.
</p>
<button
type="button"
className="bg-foreground text-background inline-flex h-11 items-center gap-2 rounded-lg px-6 font-medium no-underline transition-opacity hover:opacity-90"
>
Get Started
<ArrowRight className="size-4" />
</button>
</div>
</div>
)
}






























