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.

Specimen
Motion capture of the mounted demo, recorded by the harness. No audio track.
Harness screenshot of motion-primitives-magnetic at 375 pixels wide
Harness screenshot at 375 pixels wide. No horizontal overflow recorded.
Harness screenshot of motion-primitives-magnetic at 768 pixels wide
Harness screenshot at 768 pixels wide. No horizontal overflow recorded.
Harness screenshot of motion-primitives-magnetic at 1440 pixels wide
Harness screenshot at 1440 pixels wide. No horizontal overflow recorded.

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.

Harness measurements recorded for motion-primitives-magnetic
BuildOK
MountOK
Console errors0
Uncaught page errors0
Horizontal overflowclean at 375, 768, 1440
Axe critical0
Axe serious0
Axe moderate0
Axe minor0
Gzip marginal58.9 KB (124.3 KB build, 65.4 KB baseline)
Bare modeOK
Provider requiredNO
Demo usedwritten 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

Installation record for motion-primitives-magnetic
Declared dependenciesmotion
Missing on installnone
Bare installbuilds and mounts without the shadcn-style helpers
Providerno 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.

Alternatives

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.