UI Micro-interactions
Copy Confirm
Copy icon morphs to a drawn-stroke checkmark with a green button flash and a "Copied!" toast on click; auto-cycles as a demo loop.
csslight complexitysubtle motionclickmobile-ready
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
1
When to use it
Code blocks, CLI command snippets, any copy-to-clipboard button needing clear confirmation feedback.
When not to
Production use without wiring real clipboard API — auto-cycle loop must be removed and navigator.clipboard.writeText added before shipping. Autonomous preview ends at first deliberate input and never resumes.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the code snippet text from 'npm i microfx' to 'npx create-next-app', update the accent color from #1f8f5f to #2563eb, and extend the reset delay from 1400 to 2000ms. 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
- code snippet text (#code content)
- accent/done color (#btn.done background, #1f8f5f)
- button press scale (.85 in animate call)
- autonomous preview until first deliberate input cadence (FIRST=450 / DEMO_EVERY=3000 / IDLE_BACK=3600 ms)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- busy flag guard (prevents double-fire)
- stroke-dasharray/dashoffset checkmark draw animation
- visibilitychange pause/resume
- reduced-motion guard (no demo interval under reduce)
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
- demo-v1 preview lifecycle: initialize demoEnabled from window.__foreverPreview and stop attract work on the window forever:interactive event; retain manual feedback, settling, cleanup and explicit sessions
Known limitations
- No actual clipboard write — navigator.clipboard.writeText must be added for production use
- autonomous preview cycle that stops at first deliberate input runs by default (real input takes over, resumes after a few idle seconds) — remove the demo block for purely on-demand interaction
- Toast position (bottom 18%) may overlap content on very short viewports
- State remains local to each mounted instance; format/theme remount preserves takeover, not component values.
More UI Micro-interactions components
- Add to Cart FlyNative Add button flings a product clone into a cart; first input cancels unfinished attract flights, while each manual action keeps its full 680ms flight…
- 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…
- 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 list supports pointer/touch pull and a native Refresh button. First input stops attract refreshes; manual refresh completes its spinner, row…
- 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.
- Tooltip PopHeart icon button springs a mint-green tooltip above it on hover with a cubic-bezier spring pop; click triggers a subtle press-bounce via Web Animations API.