ExitAnimation

Primitive #36

🔍 Problem it solves

When a component disappears (modal close, dropdown hide), it should animate out before being removed from DOM. Sudden disappearance is jarring. You need to delay removal until the animation finishes.

✅ Solution

animateExit(element, options) applies a CSS class that triggers the exit animation, waits for the transition/animation to finish (or a timeout), and then resolves a Promise. You can then safely remove the element from the DOM.

🧩 Used by components

Dialog, Dropdown, Popover, Tooltip, Toast, Modal, Alert

🎮 Interactive demo