tsParticles

~42kb gzipped (slim)

Animated particle backgrounds and effects for the web.


01

See It in Action

Each demo loads the slim bundle and configures a different scene -- constellation, snowfall, and a live preset switcher.

The classic tsParticles effect: floating dots connected by lines, reacting to the mouse. A hero-section background you cannot build in pure CSS.

Preview

02

What is tsParticles?

tsParticles is a JavaScript library for rendering animated particle backgrounds and effects on the web. Drop it behind a hero section and you get constellations, snow, fireflies, or confetti out of the box -- configured through a single JSON-like options object, with full keyboard, mouse, and touch interactivity.

It is the actively-maintained successor to the original particles.js (abandoned in 2017). The slim bundle is ~42kb gzipped and covers the common cases; a modular architecture lets you shrink further by loading only the shapes and interactions you actually use. Works as a plain script tag or via npm, with ready-made wrappers for React, Vue, Svelte, Angular, and Solid.

🎨
Deep Config Surface
100+ options for number, size, color, opacity, movement, links, collisions, and interactions -- one library covers almost every background-particle need.
🖱️
Built-in Interactivity
Hover repulse, attract, or grab; click-to-push or click-to-remove. Particles respond to the user with zero extra code.
🧩
Modular Builds
Load only the features you need. The slim bundle (~42kb gzipped) covers most use cases; individual shape and interaction packages are available if you want to go even smaller.

03

When to Use tsParticles

Use when
Animated hero backgrounds on marketing and portfolio sites
Constellation or network effects on SaaS landing pages
Ambient snow, rain, or fog overlays for seasonal campaigns
Brand-colored decorative particles behind feature sections
Interactive 'click to push' or 'hover to attract' micro-interactions
Avoid when
Dense scenes (1000+ particles) on low-powered mobile devices -- watch your FPS
Static backgrounds where a CSS gradient would do the same job without any JS
Interactive games or complex physics -- use PixiJS or a game engine

04

How tsParticles Compares

tsParticles vs particles.js (original)

tsParticles is the actively-maintained successor. particles.js stopped getting commits in 2017 and has known bugs on modern browsers. If you still use particles.js, migrate -- tsParticles keeps a similar config shape.

tsParticles wins at
Active development, TypeScript, modern browser fixes, 100+ new config options, preset packages, framework wrappers
particles.js (original) wins at
Historical familiarity, tons of blog tutorials still reference it, slightly smaller single-file bundle
tsParticles vs Three.js

Three.js renders 3D scenes with WebGL -- particles are one tiny part of what it does, and writing a particle system from scratch means configuring geometries, materials, and shaders. tsParticles is 2D canvas and designed specifically for background particles.

tsParticles wins at
2D canvas (runs everywhere, no WebGL needed), declarative config, 100+ options out of the box, ~42kb vs ~600kb for Three.js
Three.js wins at
True 3D depth with perspective, custom shaders, integrates with 3D scenes, used for games and product visualizations
tsParticles vs CSS gradients + animations

For a static gradient background, pure CSS is smaller, faster, and accessible by default. Reach for tsParticles when you need motion and interactivity -- individual moving elements that respond to the cursor.

tsParticles wins at
Motion, interactivity, click/hover responses, particle collisions, designer-rich presets (stars, snow, fireflies)
CSS gradients + animations wins at
Zero JS, zero dependencies, GPU-accelerated, works with no script at all, friendlier to assistive tech

05

Get Started with tsParticles

Terminal
npm install @tsparticles/slim
Terminal
yarn add @tsparticles/slim
HTML
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/[email protected]/tsparticles.slim.bundle.min.js"></script>
Quick Start
<!-- HTML: a container for the particles -->
<div id="particles" style="width:100%; height:100vh; background:#0a0a1a;"></div>

<script src="https://cdn.jsdelivr.net/npm/@tsparticles/[email protected]/tsparticles.slim.bundle.min.js"></script>
<script>
  // loadSlim registers shapes + particle updaters. The slim bundle does
  // not auto-init, so calling it before load() is required.
  (async () => {
    await loadSlim(tsParticles);

    // Classic constellation background
    await tsParticles.load({
      id: "particles",
      options: {
        fullScreen: { enable: false },
        particles: {
          number: { value: 80 },
          color:  { value: "#ffffff" },
          links:  { enable: true, color: "#ffffff", distance: 150, opacity: 0.4 },
          move:   { enable: true, speed: 1.5 },
          opacity:{ value: 0.5 },
          size:   { value: 3 }
        },
        interactivity: {
          events: { onHover: { enable: true, mode: "repulse" } },
          modes:  { repulse: { distance: 100 } }
        }
      }
    });
  })();
</script>

06

Related Libraries