UI Micro-interactions
Magnetic Button Press
Glowing teal pill auto-cycles a press: squash/bulge, white ripple burst, and label that drifts magnetically toward an orbiting cursor dot.
canvasmedium complexitymoderate motionpointer
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
CTA button demos, interactive UI showcases, onboarding flows where you want to suggest tappability without requiring real user input.
When not to
Production buttons requiring real click handling — the press is auto-cycled; wire a real click event and remove the loop before shipping.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the button label from 'PRESS' to 'BUY NOW', set ACC to '#34D399' for a green accent, and slow the cycle by changing PERIOD from 190 to 280. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- accent color (ACC='#22AEC3')
- label text (label='PRESS')
- cycle length (PERIOD=190)
- squash intensity (press*0.06)
- magnetic pull strength (pullStr=0.10)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- DPR-aware canvas sizing
- visibilitychange pause/resume
- prefers-reduced-motion guard
- IIFE wrapper
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Press cycle is auto-driven — not wired to real pointer clicks; replace with a click listener for production use
- Ripple fires on the auto-cycle depress edge, not on actual user input
More UI Micro-interactions components
- Add to Cart FlyProduct tile flings a mini clone in a bezier arc into a cart icon on click; badge count bumps with a spring bounce. Auto-cycles as demo.
- Notification BellSVG bell swings and rings with a ripple wave on click; a red badge counter pops in with a springy bounce and increments each ring. Auto-cycles every 2…
- Copy ConfirmCopy icon morphs to a drawn-stroke checkmark with a green button flash and a "Copied!" toast on click; auto-cycles as a demo loop.
- Swipe Card StackTinder-style draggable card stack — drag the top card left/right to reveal NOPE/LIKE stamps; fling-away animates it off-screen and cycles to the next card.
- Pull to RefreshA phone-frame mockup with draggable list rows; pulling down reveals a teal arc spinner that fills and rotates, then triggers a skeleton-row flash on release.
- Accordion ExpandThree FAQ panels smoothly expand and collapse with a CSS height transition; a chevron rotates 180 degrees to indicate open state. Auto-cycles as demo.