Components
Magnet Dots
Dots that push away from the cursor.
ProPro, coming soon.
Push the dots around
<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
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Content shown over the dots. | |
color | string | "#a1a1aa" | Dot colour. |
spacing | number | 24 | Pixels between dots. |
radius | number | 110 | Pixels around the pointer that push. |
strength | number | 28 | Pixels a dot moves right at the pointer. |
className | string | Classes for the wrapper. |
With reduced motion, it draws one still frame and doesn't react to the pointer.