Magnetic

Requires framer-motion
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/button-magnetic

About this component

The button follows the cursor with spring physics, pulling toward the mouse like a magnet and bouncing back on leave.

Triggers

  • Hover
  • Spring

Techniques

  • Mouse tracking
  • Transform only

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

useReducedMotion() checked before applying motion values: button stays static when preference is set.

Use it in anything you build, commercial and client work included. Licence

More buttons

See all
Neon PulseGet code
Orbit ParticlesGet code