HeightTransition

Primitive #37

🔍 Problem it solves

Collapsible sections need to animate height from 0 to full content height. CSS transitions don't work well with `height: auto`. You must measure the content height and set explicit pixel values to animate smoothly.

✅ Solution

animateHeight(element, open, duration) measures the element's scrollHeight, sets an explicit height, animates to the target height, then resets to `auto` (or `0`) after the animation. It returns a Promise that resolves when the animation completes.

🧩 Used by components

Collapsible, Accordion, ExpandableSection, TreeView, Details

🎮 Interactive demo