223
Buttons and icons lean toward your pointer as it comes near, labels drifting a little further than their buttons, then spring back the moment you move away.
akamagnetic button·cursor attraction·hover effect
Run this in any project set up for the shadcn CLI. It copies the Magnetic source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/magnetic.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { MagneticField } from "@/components/magnetic";
export default function Page() {
return <MagneticField />;
}A free React motion component in the Cursor collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Magnetic source. Everything is optional unless it says required. It also accepts ComponentProps<"div">.
| Prop | Type | Default |
|---|---|---|
| childrenrequired | ReactNode | — |