The MagneticButton uses Framer Motion's robust spring physics to create a highly tactile, physical interaction. When a user hovers near or over the button, it pulls towards their cursor, snapping back into place when they leave. Now featuring 3 physics variants to simulate different physical materials.
Live Preview
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { MagneticButton } from "@/components/creative/magnetic-button";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { MagneticButton } from "@/components/creative/magnetic-button";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<MagneticButton
magneticPull{10}
scale{10}
speed{10}
>
<div>Content goes here</div>
</MagneticButton>
</div>
);
}