Magnetic Button
Designmagnetic-buttonMagnetic Button is an Agent Skill for design published in the nexu-io/motion-anything repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Make a primary button feel alive by gently pulling it toward the cursor as it approaches, then springing back. Keep it subtle and reserve it for one or two primary actions. Disabled on touch and under prefers-reduced-motion. Do not use it on dense UIs full of buttons.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/nexu-io/motion-anything/blob/HEAD/recipes/web/magnetic-button/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/magnetic-button, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
magnetic-button
A button that leans toward the cursor, then springs back. Part of
motion-anything; obeys MOTION-SPEC.md.
When to use it
- A single primary call-to-action you want to feel alive (hero "Get started" / "Try it").
When NOT to use it (restraint)
- Dense UIs with many buttons — it becomes chaotic. Reserve for 1–2 primary targets.
- Touch-only contexts (no cursor). The recipe disables itself there automatically.
How to apply
- Copy
magnetic-button.cssandmagnetic-button.jsinto the project, and link them. - Mark the button:
<button class="magnetic" data-magnet-strength="0.3">Get started</button> - Auto-attaches to
.magnetic. Keepstrengthsmall (~0.2–0.4) so the pull stays subtle.
Accessibility & performance
- Disabled under
prefers-reduced-motionand on(hover: none)touch devices. - Transform only; resets on
pointerleave.
Framework notes
- React: call
attachMagnetic(ref.current)inuseEffect, guarded by the same reduced-motion/touch checks.