beta

Particles — <mv-particles>

Canvas particles that drift and twinkle, pushed away or pulled in by the cursor with an elastic return; an optional constellation mode links neighbors and the pointer.

CategoryBackgrounds
TypeWeb Component (<mv-particles>)
Statusbeta
Keywordsparticles, sparkles, constellation, interactive, hero, canvas

When to use

Avoid when

Install

node scripts/add.mjs particles --out ./src/marvelous

AI agent with the Marvelous UI MCP server: install_components({ slugs: ["particles"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).

Files copied (dependencies included): tokens/tokens.css, core/base.css, core/canvas.js, core/dom.js, core/element.js, core/motion.js, core/pointer.js, components/particles/particles.js, components/particles/particles.css.

Usage

Canonical markup — start from it and customize with attributes, data-* and CSS variables:

<div style="display:grid;grid-template-columns:1.6fr 1fr;min-height:320px">
  <section style="position:relative;display:grid;place-items:center;text-align:center;overflow:hidden;padding:2rem">
    <mv-particles data-fill connect></mv-particles>
    <div style="position:relative">
      <p style="margin:0;font:700 clamp(1.6rem,4vw,2.6rem)/1.1 var(--mv-font-sans);letter-spacing:-.03em">Everything is connected</p>
      <p style="margin:.6rem auto 1.2rem;max-width:30rem;color:var(--mv-fg-muted)">A constellation that parts as your cursor passes through.</p>
      <a class="mv-button" href="#particles">Build my network</a>
    </div>
  </section>
  <section style="position:relative;display:grid;place-items:center;text-align:center;overflow:hidden;border-left:1px solid var(--mv-border);padding:1.5rem">
    <mv-particles data-fill interaction="attract" color="var(--mv-accent)" density="1.4"></mv-particles>
    <div style="position:relative">
      <strong style="display:block;font-size:1.1rem">Attracted sparks</strong>
      <span style="font-size:.85rem;color:var(--mv-fg-muted)">interaction="attract"</span>
    </div>
  </section>
</div>

API

Attributes

NameTypeDefaultDescription
countnumberFixed count (otherwise proportional to the area, max 500 / 220 with connect).
densitynumber1Multiplies the automatic count.
interactionrepel | attract | nonerepelReaction to the cursor.
radiusnumber120Cursor influence radius (px).
connectbooleanLinks nearby particles (constellation), and the cursor.
link-distancenumber120Max link distance (px).
colorCSS colorvar(--mv-particles-color)Particle color (tokens accepted, follows the theme).
link-colorCSS colorvar(--mv-particles-link)Link color.
sizenumber2Max particle radius (px).
speednumber1Drift speed.
data-fillbooleanFills the positioned parent; the cursor is then tracked on the parent.

CSS variables

NameDefaultDescription
--mv-particles-colorfg 75%Default particle color.
--mv-particles-linkaccent 70%Default link color.

Accessibility

Decorative canvas (aria-hidden), pointer-events: none with data-fill. Pauses off-screen and in hidden tabs. Reduced motion: a still image with no cursor reaction.