loading code fetching the highlighted snippet
A single boolean (isOpen) flips the parent into a named variant. The variant cascades into every descendant — stack chrome, header, and each notification expose their own open / closed definitions and animate together.
isOpen. The parent motion.div sets animate={isOpen ? 'open' : 'closed'} — motion then walks the descendant tree looking for matching variants keys and animates each one.closed variant is parameterised by its index — the further
down the stack, the more it offsets, scales, and fades. So three cards collapse into a
layered preview that re-expands cleanly.transition objects let the header lead/lag the cards via delay, and each notification staggers by i * 0.04s — a single boolean still drives a feel-good cascade.