Particles
MotionReact canvas background of drifting particles that repel or attract around the pointer, colored from your accent token and sharp on high density screens.
Installation
npx shadcn@latest add @minidev/particles
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/particles.json
Usage
import { Particles } from "@/components/ui/particles"
export function Example() {
return (
<Particles />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| quantityNumber of particles. | number | 110 |
| sizeRadius of the nearest particles in pixels. Farther ones are smaller. | number | 2 |
| colorAny CSS colour, including var(--token). Defaults to the accent. | string | "var(--accent)" |
| modePush particles away from the pointer, or pull them toward it. | "repel""attract" | "repel" |
| radiusReach of the pointer in pixels. | number | 120 |
| driftDrift speed multiplier. 0 holds the field still apart from the pointer. | number | 1 |
| className | string | - |
| children | React.ReactNode | - |
When to use
Use it behind a hero or CTA panel that should feel alive under the pointer. Reach for Meteors for streaks, LightField for a soft WebGL glow, and DotPattern or FlickeringGrid for a static or barely moving texture.
Accessibility
- The canvas is
aria-hiddenandpointer-events-none; children render above it. - Under reduced motion it draws one still frame and does not listen to the pointer at all.
Frequently asked questions
How do I make particles follow or avoid the cursor?
mode="repel" (default) pushes them away and mode="attract" pulls them in, within radius pixels (default 120). Pointer moves are read on the window, so it works through the content on top.
Will Particles slow down my page?
It draws quantity dots (default 110) on one canvas, capped at 2x device pixels, and stops when off screen or in a background tab. Lower quantity for large panels on phones; drift={0} holds the field still except near the pointer.
Dependencies
npm
Built from
Examples
Attract mode
mode="attract" pulls particles toward the pointer instead of parting around it; radius sets how far the pull reaches.
Dense and still
drift={0} holds the field in place so only the pointer moves it; a small size and the ink colour read as a starfield.
Email capture
Children sit above the canvas and keep the pointer, so a form works as usual; the second accent colours the dots.