Component Props
All moti components have a few useful props:
animateMagically animate any value passed herefromThe initial animation styles when the component mountsexitUnmount animation styles. This works the exact same asframer-motion's exit prop, and requires wrapping your component withAnimatePresence. The only difference is you importAnimatePresencefrommoti.transitionTake full control over your animation configuration. You can set options for your entire animtation (such astype: 'timing'), or set transition options per-style (translateY: { type: 'timing' }).exitTransitionThe exact same astransition, except that it only applies toexitanimations.stateIf you're using theuseAnimationStatehook, you should pass the state it returns to this prop.onDidAnimateCallback function called after finishing a given animation.- First argument is the style prop string (
opacity,scale, etc.) - The second argument is whether the animation
finishedor not (boolean)
- First argument is the style prop string (
exitTransition#
Define animation configurations for exiting components.
Options passed to exitTransition will only apply to the exit prop, when a component is exiting.
By default, exit uses transition to configure its animations, so this prop is not required.
However, if you pass exitTransition, it will override transition for exit animations.
To see how to use this prop, see the transition docs.