UI Micro-interactions
Tooltip Pop
Heart 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.
csslight complexitysubtle motionhover
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
1
When to use it
Icon-only buttons needing a label reveal, favorites or bookmark actions, any UI where a tooltip clarifies an ambiguous control.
When not to
Touch-only interfaces where hover is unavailable; layouts where there is no room above the button for the tooltip to appear.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change tooltip text to 'Save for later', update accent color from #4fe0c0 to #a78bfa, and slow the spring transition to 0.36s. 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
- tooltip label text (#tip inner text)
- accent color (#4fe0c0)
- spring easing (cubic-bezier(.2,1.5,.4,1))
- tooltip offset (bottom: calc(100% + 14px))
- autonomous preview until first deliberate input cadence (first pop after 400 ms, then alternates every 1700 ms)
- button size (54px)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- reduced-motion guard (reduce var)
- visibilitychange pause (clearInterval)
- IIFE wrapper
- pointerenter/pointerleave listeners
- hover takeover (hover flag: the demo never toggles under a real pointer)
- 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
- 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
- Tooltip position is hardcoded above the button; may clip at top of viewport
- Button div lacks aria role and aria-label — add for production accessibility
- 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…
- 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 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.