SmoothKit
v1.0.0
DocsComponents

Smooth Collapse

The missing piece for generic height animations. Animate to and from "height: auto" effortlessly.

SmoothKit solves the complex problem of animating height to "auto" in CSS. Normally, browsers cannot transition between "0" and "auto". This hook calculates the exact pixel height needed, performs the transition, and then resets to auto for responsiveness.

Installation

npm install smoothkit

Usage

typescript

API Reference

PropertyTypeDefaultDescription
durationnumber300Transition duration in ms.
easingstring'ease'CSS easing function.
initialOpenbooleanfalseWhether the content starts expanded.