design-infraGitHub
Report a problem or share feedback← Catalog

Drag: Lock direction

free

motion/drag-lock-direction

An example of locking the drag direction of an element based on its initial drag direction using Motion for React's dragDirectionLock prop.

drag — mediumrecipeRefinedPlayful
$pnpm add motion # then adapt the free source from https://motion.dev/examples/react-drag-lock-direction

npm deps: motion

Drag: Lock direction preview
Source
Motion (motion.dev)
Kind
transition
Categories
transition
Use as
recipe — technique you apply to your own markup
Motion
on drag · medium · motion · medium cost
Tags
motion, animate
Licence
motion / motion/react / motion-v are MIT. Motion+ (premium components, example source, AI Kit pro tools) is paid — one-time Personal licence or per-seat Business.
Live demo
motion.dev
Docs
motion.dev