Skip to Content
zjkm-ui
Components

Magnet Dots

Dots that push away from the cursor.

ProPro, coming soon.

Push the dots around

Props
24px
110px
28px
<MagnetDots>
  <Hero />
</MagnetDots>

Get notified

Magnet Dots is a Pro effect. Join the waitlist and we'll email you when it's available.

Usage

A grid of dots that push away from the pointer, like iron filings near a magnet, then ease back into place. It draws on a canvas, and the drawing stops while it's off-screen or the tab is hidden. Without canvas support, your content shows on its own.

import { MagnetDots } from "@zjkm/pro/magnet-dots";

export function Hero() {
  return (
    <MagnetDots className="rounded-2xl p-16">
      <h1>Feel the pull</h1>
    </MagnetDots>
  );
}

Props

PropTypeDefaultDescription
childrenReactNodeContent shown over the dots.
colorstring"#a1a1aa"Dot colour.
spacingnumber24Pixels between dots.
radiusnumber110Pixels around the pointer that push.
strengthnumber28Pixels a dot moves right at the pointer.
classNamestringClasses for the wrapper.

With reduced motion, it draws one still frame and doesn't react to the pointer.

On this page