Particles are a fun way to add some visual flair to your website. They can be used to create a sense of depth, movement, and interactivity.
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 { useTheme } from "next-themes"
import { Particles } from "@/registry/magicui/particles"
export default function ParticlesDemo() {
const { resolvedTheme } = useTheme()
const color = resolvedTheme === "dark" ? "#ffffff" : "#000000"
return (
<div className="bg-background relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border">
<span className="pointer-events-none z-10 text-center text-8xl leading-none font-semibold whitespace-pre-wrap">
Particles
</span>
<Particles
className="absolute inset-0 z-0"
quantity={100}
ease={80}
color={color}
refresh
/>
</div>
)
}






























