Measured entry
motion-primitives-magnetic
hover-effect3dmotion on file
A client-side React wrapper that pulls its child toward the pointer, then returns it with spring motion. It ships as a copyable TSX registry component, imports motion/react, and uses React state, refs, effects, motion values, and a document-level mousemove listener. Its trigger area can be the wrapper, its parent, or the page.



Measured
Every value below was written by the harness on the run that produced the frames above. None of it is derived from the prose.
| Build | OK |
|---|---|
| Mount | OK |
| Console errors | 0 |
| Uncaught page errors | 0 |
| Horizontal overflow | clean at 375, 768, 1440 |
| Axe critical | 0 |
| Axe serious | 0 |
| Axe moderate | 0 |
| Axe minor | 0 |
| Gzip marginal | 58.9 KB (124.3 KB build, 65.4 KB baseline) |
| Bare mode | OK |
| Provider required | NO |
| Demo used | written from the component source API |
Verdict
A focused, configurable hover primitive that builds and mounts cleanly even outside a shadcn scaffold. It is a good fit for selective pointer polish, but the document listener and pointer-only behavior make it a poor default for repeated or essential controls.
Use it if
- You want a restrained magnetic response on a button, link, or other compact call to action.
- You need to tune attraction strength, activation range, spring behavior, or the trigger area.
- Your interface already uses Motion and can absorb another client-side interaction wrapper.
Skip it if
- The interaction must communicate essential state to keyboard or touch users, since the effect follows mouse movement only.
- You are avoiding Motion or additional client-side JavaScript for a small decorative effect.
- The child cannot be wrapped in a translating div without affecting layout or stacking behavior.
- You need built-in reduced-motion handling rather than adding that policy around the component yourself.
Install
| Declared dependencies | motion |
|---|---|
| Missing on install | none |
| Bare install | builds and mounts without the shadcn-style helpers |
| Provider | no provider required in the harness |
In a non-shadcn project, add the Motion package, copy the TSX component into your UI code, and ensure it runs behind a client boundary. Add your own reduced-motion policy if the surrounding application does not already provide one.
Source and credit
This page is a review, not a copy. The component source lives with its author and this site does not republish it. Read the license before you use anything.
Author repository
github.com/ibelick/motion-primitivesAlternatives
Other published entries for the hover-effect pattern, ordered by what they measured: mounts first, then clean axe scans, then bare-mode passes, then the smaller bundle.
- eldora-card-flip-hover3d
- Renders
- YES
- A11y
- 0
- Gzip
- 17.5KB
- Bare
- pass
- Prov
- NO
- uilayouts-btn-hover-left-flip3d
- Renders
- YES
- A11y
- 0
- Gzip
- 17.5KB
- Bare
- pass
- Prov
- NO
- uilayouts-btn-hover-down3d
- Renders
- YES
- A11y
- 0
- Gzip
- 17.6KB
- Bare
- pass
- Prov
- NO
- uilayouts-btn-hover-multiplegradient-glow
- Renders
- YES
- A11y
- 0
- Gzip
- 17.9KB
- Bare
- pass
- Prov
- NO
- magicui-cool-modespatial
- Renders
- YES
- A11y
- 0
- Gzip
- 21.8KB
- Bare
- pass
- Prov
- NO
- uilayouts-hovercard2gradient-glow
- Renders
- YES
- A11y
- 0
- Gzip
- 24.0KB
- Bare
- pass
- Prov
- NO