Getting Started
Blocks
Components
Device Mocks
Special Effects
Animations
Text Animations
Buttons
Particles
"use client";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
import { Particles } from "@/registry/magicui/particles";
export function ParticlesDemo() {
const { resolvedTheme } = useTheme();
const [color, setColor] = useState("#ffffff");
useEffect(() => {
setColor(resolvedTheme === "dark" ? "#ffffff" : "#000000");
}, [resolvedTheme]);
return (
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-background">
<span className="pointer-events-none z-10 whitespace-pre-wrap text-center text-8xl font-semibold leading-none">
Particles
</span>
<Particles
className="absolute inset-0 z-0"
quantity={100}
ease={80}
color={color}
refresh
/>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @magicui/particles
Usage
import { Particles } from "@/components/magicui/particles";
<div className="relative overflow-hidden h-[500px] w-full">
<Particles />
</div>
Props
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | The class name for the component |
quantity | number | 100 | The number of particles |
staticity | number | 50 | The staticity of the particles |
ease | number | 50 | The ease of the particles |
size | number | 0.4 | The size of the particles |
refresh | boolean | false | Whether to refresh the particles |
color | string | #ffffff | The color of the particles |
vx | number | 0 | The x velocity of the particles |
vy | number | 0 | The y velocity of the particles |
Limited Time Offer
Ship Faster with Magic UI ProMagic UI Pro
Stop building from scratch.
Get 8 production-ready templates and 50+ premium components that your users will love.
✓
Next.js 15 + TypeScript ready✓
Copy, paste, customize in minutes✓
Save 100+ hours of development