ThatDesignUIOriginalInteractive preview
Magnetic button
A black pill call to action that drifts toward the cursor inside a generous hover zone, its label drifting a little further, then springs back.
- Category
- Buttons
- Platform
- Responsive
Interactive componentClick through it, resize it, or switch states. It’s real UI, not a screenshot.Default state
Use this component
Free to use. It works on its own in any React and Tailwind project, so you can add it with one command, paste the code, or hand the prompt to your coding agent.
FreeReact 18+Tailwind v3.4 or v4No extra packages
1. Add it with the shadcn CLI
npx shadcn@latest add https://www.thatdesignui.com/r/magnetic-button.json2. Use it
Every prop is optionalapp/page.tsx
import MagneticButton from "@/components/magnetic-button";
export default function Page() {
return <MagneticButton />;
}Prefer to paste it yourself? Open the .
Under the hood
How it’s built
What’s inside
- A 56px black pill with white 15px semibold text and a 40px white circle on the right holding a black arrow, on a warm off-white panel.
- Inside a hover zone 48px larger than the button on every side, the button follows the cursor by 35% of its distance from the centre, capped at 14px, and the label moves 40% further than the button.
- Leaving the zone springs everything back with a slightly overshooting curve; disabled is flat grey.
How it behaves
- Moving the cursor near the button pulls it toward the cursor and never more than 14px.
- Leaving the zone returns the button to its exact resting place.
- Tabbing to it shows a clear ring and nothing moves.
- Nothing moves when reduced motion is on.



