Command Palette

Search for a command to run...

Docs
Particle Field

Particle Field

An interactive particle field with mouse attraction and connection lines

Installation

Usage

import ParticleField from "@/components/ruixen/particle-field";
 
export default function App() {
  return (
    <div className="relative h-screen w-full">
      <ParticleField
        particleCount={100}
        particleSize={2}
        particleColor="white"
        backgroundColor="black"
        speed={0.5}
        connectDistance={120}
      />
      <div className="relative z-10">{/* Your content here */}</div>
    </div>
  );
}

Props

PropTypeDefaultDescription
particleCountnumber100Number of particles to render
particleSizenumber2Size of individual particles
particleColorstring"white"Color of the particles
backgroundColorstring"black"Background color of the canvas
speednumber0.5Movement speed of particles
connectDistancenumber120Distance at which particles connect with lines
styleCSSProperties{}Additional inline styles
classNamestring""Additional CSS classes

Features

  • Interactive: Particles are attracted to mouse cursor
  • Connected: Lines drawn between nearby particles
  • Bouncing: Particles bounce off canvas edges
  • Customizable: Full control over appearance and behavior
  • Performance: Optimized canvas rendering