Zum Inhalt springen
Kitbay
Skill

gestures

MITAktualisiert am 9. Nov. 202655.996GitHub-Sterne

A skill from Emil Kowalski's collection for building drag, swipe and sheet interactions on the web that follow the finger exactly and can be caught mid-motion.

Was der Skill vermittelt

A skill from Emil Kowalski's collection for building drag, swipe and sheet interactions on the web that follow the finger exactly and can be caught mid-motion. While the pointer is down the element tracks it one to one with no easing or React state updates, with rubber-band resistance past an edge; on release a spring seeded with the release velocity finishes the motion, and dismissal depends on distance or a fast flick. For bottom sheets and drawers it recommends the Vaul library over hand-rolled code. It also covers keeping overlays in sync with drag progress, dismissing in the entry direction, hold-to-confirm timing, touch targets, touch-action and reduced-motion fallbacks.

Funktionen

  • Make drags track the pointer one to one
  • Finish flings with velocity-seeded springs
  • Set dismiss thresholds by distance or speed
  • Add reduced-motion fallbacks to gestures