design-infraGitHub
Report a problem or share feedback← Catalog

Drag: Constraints

free

motion/drag-constraints

An example of making an element draggable using Motion for React's drag prop. You can even set drag constraints by providing a ref to another element.

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

npm deps: motion

Drag: Constraints preview
Source
Motion (motion.dev)
Kind
transition
Categories
transition
Use as
recipe — technique you apply to your own markup
Applies to
cardcarousel
Motion
on drag · medium · motion · medium cost
Tags
motion
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