Magnetic button
A button that springs toward the pointer within a radius, with the label moving a little further; inactive on coarse pointers and reduced motion.
What it is for
landing hero call to action, sign-up, pricing
Use it
1 · site.json
"effects": { "components": ["magnetic-button"] }or on the command line
node ~/.claude/skills/sitewright/scripts/scaffold.mjs --config site.json --out ./my-site --components magnetic-button2 · import it
import { MagneticButton } from '@/components/fx/ui';Files
components/fx/ui/MagneticButton.tsxcomponents/fx/ui/_d3.tsui-magnetic-button.cssstyles
Source
Idea from Hover Interaction Collection; the code is written for this kit.
Credits and licences: third-party notices.
Accessibility
- Keyboard. Components in the kit are written to be reached and used with the keyboard. Try it: press Tab inside the preview.
- Reduced motion. With
prefers-reduced-motionon, animation settles to its finished state at once. - Touch. Pointer-follow effects are skipped on touch screens; controls stay finger-sized.