Micro-interactions
Magnetic Button
A button that leans into your cursor — caught in a magnetic field it slides toward the pointer while an amethyst aura swells with proximity, then snaps home on a spring and answers every click with a dark ripple bursting outward from the point of contact.
Install
bun add motionProps
| Prop | Type | Default | Description |
|---|---|---|---|
| pullStrength | number | 0.4 | Fraction of the cursor offset the button follows. |
| radius | number | 120 | Field radius where the magnetic pull begins. |
| stiffness | number | 260 | Spring stiffness of the pull and return. |
| damping | number | 18 | Spring damping — lower overshoots and rings. |
| auraColor | string (hex) | "#a855f7" | Color of the proximity glow. |
| auraSize | number | 80 | Spread of the aura at full proximity. |
| ripple | boolean | true | Emit a dark ripple burst on click. |
| rippleColor | string (hex) | "#d2abfd" | Color of the click ripple. |
What It Demonstrates
- Hover effect
- Visual change when the cursor moves over an element.
- Spring
- Motion driven by physics (tension, mass, damping) rather than a set duration.
- Ripple
- A circle expanding from the point of a tap, confirming the press.
- Press / Tap feedback
- A subtle scale-down when an element is clicked, so it feels physical.
- Momentum
- Motion that carries velocity, especially after a drag or interruption.
Related Components
Shadow Cursor
A custom cursor with a shadow at its heel — a precise dot leads while a lagging blade trails on a spring, and when it crosses an interactive element the trail pools and swells around it, inverting whatever lies beneath. Scoped entirely to its own stage; the page cursor is never touched.
Hover List
A display-type list where a shared accent block springs between rows on hover while the text indents and inverts.
Reorder
A sortable list that answers to a finger and to a keyboard equally — grab a row, and the rest step aside to make the space.
Dial
A machined rotary knob: angular drag with detents you can feel on the way past, inertia on a flick, and a spring that settles into the nearest stop. The angle lives in a motion value rather than in React state — a drag writes it sixty times a second and a spring more often than that — so the only thing React holds is the detent index, and only when that integer actually changes. Arrow keys step through the same spring the hand does, so the keyboard is not a second, worse path to the same control.
Pixel Transition
Reveal a second layer through a random pixelated dissolve on hover.
Border Glow
A cursor-proximity gradient border with an outer glow.