Report a problem or share feedback← Catalog
Drag: Constraints
freemotion/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.
$
pnpm add motion # then adapt the free source from https://motion.dev/examples/react-drag-constraintsnpm deps: motion

- 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
Similar
Compare all 4 →- Dragmotion/dragdrag + constraints + momentum: draggable cards, swipeable panels, sliders. Free example (motion is MIT); copy and adapt the source from the example page.
- AnimateView: App Storemotion/animate-view-app-storeAn example of animating cards inspired by the iOS App Store using AnimateView's shared element transitions from Motion for React.
- Clerk: Sign-in-or-upmotion/clerk-sign-inA complete custom sign-in-or-up flow built with Motion, combining the conditional password field and the card-stack verification step. Wire the same UI to Clerk's useSignIn() and useSignUp() hooks.