Motionshelf
← All components

Buttons

Magnet

The pointer becomes a horseshoe magnet: iron filings behind the button line up along the field between it and the button, and the button leans toward it on a spring.

Install

npx shadcn@latest add https://motionshelf-pi.vercel.app/r/magnet-button.json

Copies the file into your project. Requires React 19, Tailwind CSS v4 and GSAP (installed as a dependency).

Props

NameTypeDefaultDescription
childrenReactNode—The button label.
pullnumber36How far the button can be pulled toward the pointer, in px.
playgroundClassNamestring""Classes for the play area, which fills the nearest positioned ancestor.
classNamestring""Extra classes for the button.

Dependencies