Installation
Install Motion via npm or yarn:Quick Start
Motion exports everything fromframer-motion, providing both motion and m components:
Core Concepts
Motion Components
Motion wraps standard HTML and SVG elements with animation capabilities. Any HTML or SVG element can be animated by prefixing it withmotion.:
Animation Props
Motion components accept several props to control animations:initial- Starting state for animationsanimate- Target state for animationsexit- State when component is removed (requiresAnimatePresence)transition- Configuration for the animationstyle- Enhanced style prop supportingMotionValues
Gesture Animations
Motion provides declarative gesture handlers:The m Component
For bundle size optimization, Motion also exports a minimal m component with the same API:
Package Structure
Motion is a re-export offramer-motion, which is part of a larger monorepo:
motion- Main package, re-exports everything fromframer-motionframer-motion- React-specific animation codemotion-dom- Vanilla JavaScript animation librarymotion-utils- Pure functions and easing utilities
TypeScript Support
Motion is written in TypeScript and provides full type definitions:Next Steps
- Learn about Motion Components and available elements
- Explore AnimatePresence for exit animations
- Discover Layout Animations for shared element transitions
- Master React Hooks for advanced animation control
Performance
Motion is highly optimized for performance:- Uses GPU-accelerated transforms when possible
- Batches reads and writes to prevent layout thrashing
- Supports reduced motion preferences
- Provides tools like
LazyMotionfor code splitting