Report a problem or share feedback← Catalog
Exit animation
curatedfreemotion/exit-animation
An example of animating an element when it's removed from the DOM using AnimatePresence in Motion for React.
$
pnpm add motion # then adapt the free source from https://motion.dev/examples/react-exit-animationnpm deps: motion
Our notes
AnimatePresence exit: modals, toasts and removed list items animate OUT instead of vanishing. The fix for 'abrupt' close. Free example (motion is MIT); copy and adapt the source from the example page.
- Source
- Motion (motion.dev)
- Kind
- transition
- Categories
- transition
- Use as
- recipe — technique you apply to your own markup
- Applies to
- modaltoastcard
- Motion
- on state · subtle · motion · low cost
- Tags
- motion, AnimatePresence, animate, whileTap
- 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 →- Motion presetsoc/motion-presetsdesign-infra's motion languages (still / quiet / lively / cinematic) as motion/react transitions, springs and variants (fadeUp, scaleIn, stagger, press, lift). Set PROJECT_MOTION to your DESIGN.md `motion:` so hand-written animations match the system.
- Modal open / closetransitions/modalScale-from-center modal open/close timings that feel native.
- Toast open / closetransitions/toastRise + blur toast entrance; matches Sonner stacking.