forever components

UI Micro-interactions

Pull to Refresh

A 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.

css+canvasmedium complexitymoderate motionpointer

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
Worth keeping? Votes steer what gets built next — sign in to cast one, free to read

When to use it

Demoing mobile pull-to-refresh patterns, onboarding flows showing gesture affordances, or UI kit showcases.

When not to

Production refresh logic — the auto-cycle timer and demo frame must be removed; also skip in contexts where cursor/touch drag conflicts with page scroll.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change the spinner color from teal (#3ad6c5) to coral (#ff6b6b), increase MAX pull distance to 90, and slow the auto-cycle timer from 2400ms to 4000ms. 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

  • MAX pull distance (MAX=60)
  • spinner stroke color (#3ad6c5)
  • auto-cycle delay (2400ms)
  • row count (7)
  • refresh spin duration (700ms / 1400ms)
  • ease duration (260ms)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • visibilitychange pause + clearTimeout guard
  • prefers-reduced-motion guard (reduce check stops auto-loop)
  • touch/mouse unified event handlers
  • IIFE-less but scoped const declarations
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • touchmove is passive:true so calling preventDefault to block page scroll is not possible — may conflict with scrollable parent containers
  • No aria roles on draggable area — needs role=button or gesture instructions for screen readers in production
  • Auto-cycles indefinitely — remove loop() call and timer for production use

pull-to-refreshmobiledragspinnerskeletonmicrointeractiontouch

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.
  • 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.