design-infraGitHub
Report a problem or share feedback← Catalog

Exit animation

curatedfree

motion/exit-animation

An example of animating an element when it's removed from the DOM using AnimatePresence in Motion for React.

state — subtlerecipeRefinedPlayful
$pnpm add motion # then adapt the free source from https://motion.dev/examples/react-exit-animation

npm 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.
Exit animation preview
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