Swipe to dismiss

Map swipe distance to travel and opacity with resistance before the threshold.

Preview

A directional drag removes a surface after distance or velocity crosses a dismissal threshold.

Preview
Swipe to dismiss

Implement Swipe to dismiss: Map swipe distance to travel and opacity with resistance before the threshold. Use Duration 240ms, Distance 96px, Resistance 65%, Easing snap. Trigger it from real pointer, touch, or keyboard interaction. Use semantic HTML, scope CSS to .motion-demo--swipe-to-dismiss, and mount the provided vanilla JavaScript interaction runtime. Provide equivalent low-motion behavior for prefers-reduced-motion and .force-reduced-motion.

Learn more