MotionConfig component sets configuration options that are inherited by all child motion components. Use it to set default transitions, reduced motion preferences, and more.
Usage
Props
React children. All
motion components will inherit the configuration.Default transition for all child animations. Can be overridden by individual components.
Control motion behavior based on user preferences:
"user": Respectprefers-reduced-motionsetting (default)"always": Always reduce motion"never": Never reduce motion
If
true, all animations are skipped and values are set instantly. Useful for testing or visual regression.A custom
nonce attribute for Content Security Policy (CSP). Used when Motion injects styles.A function to determine if a prop should be forwarded to the DOM element. Use with custom elements or web components.
Transform pointer coordinates. Used internally by Framer for zoom/pan canvas.
Examples
Global Spring Transition
Reduced Motion Support
Testing Mode
Nested Configuration
Different Transitions per Section
CSP with Nonce
TypeScript
Inheritance
MotionConfig values are inherited by child MotionConfig components:
Performance
MotionConfig creates a new context when its props change. To avoid unnecessary re-renders:
- Memoize transition objects
- Keep
MotionConfighigh in the tree - Don’t update props unnecessarily
Notes
- Individual component props always override
MotionConfigsettings isStaticprop is locked on mount and cannot change- Nested
MotionConfigcomponents merge their settings - Only affects descendant
motioncomponents, not ancestors or siblings
Related
- motion - Core animation component
- transitions guide - Learn about transition types
- accessibility guide - Implementing reduced motion