Particle Network

An interactive particle-web background whose particles drift and link to each other, and whose lines reach out to the cursor — with a tether-and-relay system that keeps the cursor plugged into the web at any distance. WebGL-accelerated with a 2D canvas fallback, works through content layered on top, and follows your text color via currentColor.

Particle network

A web that reaches for your cursor.

Particles drift and link into a living network. Move your cursor and lines tether out to it, relaying through neighbours — even from across the screen. WebGL-accelerated, with a 2D fallback.

Cursor tetherWebGLcurrentColor aware

Installation

  1. 1

    Install the component:

    npx shadcn@latest add https://ui.amines.fun/registry/particle-network.json
  2. 2

    Usage:

    jsx

    app/page.jsx

    import ParticleNetwork from "@/components/ui/particle-network";// ── 1) EASIEST: wrap your content — particles render behind it automatically<ParticleNetwork className="min-h-screen bg-white text-slate-700 dark:bg-slate-950 dark:text-white/70">  <Hero /></ParticleNetwork>// ── 2) As a backdrop inside any "relative" parent — nothing else to configure.//    Keep your content above it with "relative z-10". The canvas ignores//    pointer events, so links and buttons keep working.<section className="relative min-h-screen bg-slate-950 text-sky-300">  <ParticleNetwork />  <div className="relative z-10">...your content...</div></section>// ── 3) Fixed full-page background behind the entire site.//    position="fixed" pins it; "-z-10" keeps it behind your layout.<ParticleNetwork position="fixed" className="-z-10" />// ── 4) Match your brand: colours follow the element's text colour by//    default (currentColor), or pass any CSS colour / palette.<ParticleNetwork color={["#FF7138", "#1c1c1e"]} cursorColor="#FF7138" glow />// ── 5) Programmatic control via ref://    ref.current.pause() · resume() · refresh() · burst(x?, y?)

Props

PropTypeDefaultDescriptionRequired
childrenReactNode-Content rendered above the particles. When present the component becomes a relative isolate wrapper and positions itself accordingly.No
position"absolute" | "fixed" | "relative"-Layer positioning. Defaults to "absolute" for backdrops, "relative" when children are provided. Use "fixed" for a full-page background.No
classNamestringundefinedClasses for the outer box — size, background colour, and text colour (which feeds currentColor).No
contentClassNamestringundefinedClasses for the wrapper around children (only used when children are provided).No
styleReact.CSSPropertiesundefinedInline style for the outer box.No
countnumber0Fixed particle count. 0 means automatic, derived from density and container size.No
densitynumber9Particles per 100,000 px² when count is 0 (a 1080p screen gets roughly 190).No
minParticlesnumber28Lower bound for automatic particle counts.No
maxParticlesnumberauto (≈260 desktop, ≈110 phones/low-core)Hard cap on particles. Memory is reserved up front for this many.No
size[number, number] | number[1, 2.4]Particle radius range in px, or a single number (expanded to a small range around it).No
speednumber1Drift speed multiplier. 0 freezes the network, 2 is fast.No
edge"wrap" | "bounce""wrap"What particles do at the container borders: wrap around or bounce back.No
twinklenumber0.3Brightness shimmer amount, 0 to 1.No
colorstring | string[]"currentColor"Particle colour(s): "currentColor" follows the element's text colour (any CSS colour works), or pass an array for a per-particle palette.No
lineColorstringfirst particle colourColour of the lines between particles.No
cursorColorstringfirst particle colourColour of cursor-connected lines — drawn brighter and thicker. Set e.g. "#ff7138" to accent the cursor.No
glowbooleanfalseAdditive blending for a neon look — best on dark backgrounds.No
links{ visible?: boolean, distance?: number, opacity?: number, width?: number }{ visible: true, distance: 130, opacity: 0.3, width: 1 }Idle particle↔particle lines. distance is the link range in px; set visible:false to hide idle lines (cursor-lit lines still appear via relay).No
cursorobject{ radius: 170, maxLinks: 8, opacity: 0.9, width: 1.2, fallback: "nearest", maxTether: 0, relay: 1, relayDecay: 0.55, force: "none", forceRadius: 150, forceStrength: 1, dot: true, margin: 0 }Cursor interaction. radius = max distance for direct cursor→particle lines; fallback "nearest" tethers to the nearest particle at any distance so the cursor is never floating alone; relay spreads the connection N hops through neighbours; force can attract/repel nearby particles; dot draws a node at the cursor; margin extends the active area outside the box.No
click"none" | "burst""none"Pointer-down shockwave that pushes particles away. Works on touch.No
ghost"auto" | boolean"auto"A drifting virtual cursor so touch devices without hover still show the effect. "auto" enables it only on devices without hover; it yields to the real pointer instantly.No
pausedbooleanfalseFreeze the animation. The engine also pauses itself off-screen and when the tab is hidden.No
maxFpsnumber0Frame rate cap. 0 runs at display rate; try 30 on very low-end targets.No
adaptivebooleantrueQuietly lowers the particle count if frames stay slow.No
respectReducedMotionbooleantrueUsers who prefer reduced motion get a still network that only reacts to the cursor.No
fadeInnumber0.8Canvas fade-in duration in seconds.No
refRefObject-Imperative handle: pause(), resume(), refresh() (re-reads theme colours), and burst(x?, y?) to trigger a shockwave programmatically.No