Join our Discord community
Interactive

Particles

Interactive particle animation component for React and Next.js applications. Built with TypeScript support, HTML5 Canvas, and Tailwind CSS styling featuring mouse interaction, customizable behavior, and performance optimization.

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/particles.json
npx shadcn@latest add https://www.shadcn.io/registry/particles.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/particles.json
bunx shadcn@latest add https://www.shadcn.io/registry/particles.json

Features

  • Mouse interaction - Magnetic particle attraction with real-time tracking using HTML5 Canvas for React apps
  • 60fps animations - Smooth performance with requestAnimationFrame optimization using JavaScript
  • Customizable behavior - Control quantity, size, color, speed, and movement patterns using TypeScript props
  • Responsive canvas - Auto-resize handling with container dimension detection for Next.js applications
  • Edge detection - Smooth particle fading at boundaries with automatic regeneration using Tailwind CSS
  • Open source - Free particle system with comprehensive configuration options

Examples

Interactive Experience

Loading component...

Use Cases

  • Hero sections - Dynamic backgrounds with particle animation effects
  • Interactive demos - Mouse-following effects for engagement and storytelling
  • Portfolio sites - Creative backgrounds that respond to user interaction
  • Gaming interfaces - Ambient particle effects for immersive experiences

API Reference

Particles

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the container
quantitynumber100Number of particles to render
staticitynumber50Controls how much particles are affected by mouse
easenumber50Easing factor for particle movement
sizenumber0.4Base size of particles
refreshbooleanfalseForces particles to regenerate when true
colorstring"#ffffff"Hex color code for particles
vxnumber0Horizontal velocity bias for particles
vynumber0Vertical velocity bias for particles

Implementation

Uses HTML5 Canvas with absolute positioning. Place within relative container. Content needs higher z-index. Particles auto-regenerate at boundaries. Mouse interaction calculated from canvas center.