Content
Framer Motion
Production-ready animation library for React. Motion (published as the motion package) is the default choice for component-level animation: enter/exit transitions, layout shifts, gesture responses, spring physics, and scroll-linked effects. It integrates deeply with React's component model and handles the hard parts — interrupted animations, layout measurement, exit choreography — so you can focus on feel.
Note: The project publishes as Motion (npm package name:
motion, docs: motion.dev). The legacyframer-motionpackage remains available for migration but prefer the newermotionpackages and docs on motion.dev. Import React bindings frommotion/react.
When to use
- Component mount/unmount transitions (modals, toasts, dropdowns, page transitions)
- Layout animations when elements reorder, resize, or move across containers
- Hover, tap, drag, and focus micro-interactions
- Shared element transitions across routes (with
layoutId) - Spring-based physics for interactive feel (sliders, toggles, cards)
- Scroll-linked opacity or parallax on individual elements
When NOT to use
- Scroll-driven pinning, scrubbing, or multi-section choreography — use GSAP + ScrollTrigger
- Complex multi-surface orchestration (DOM + Canvas + WebGL simultaneously) — use GSAP timelines
- Non-React projects — Motion is React-first; use Motion's vanilla API or other libraries for other frameworks