finds.dev← search

// the find

tannerlinsley/react-show

★ 399 · JavaScript · updated Dec 2022

⚛️ A 3kb css animation component for React.

A tiny (3.7kb) React component that animates height/width to `auto` and other CSS properties using native transitions instead of JS-driven animation loops. Aimed at anyone who's fought CSS to animate an accordion or collapsible panel and given up.

Solves a genuinely annoying CSS problem well: animating to `auto` height/width by measuring scrollHeight/scrollWidth under the hood, which most people hand-roll badly. Zero dependencies and a single-file implementation (src/index.js) means the whole thing is auditable in a few minutes. GPU-accelerated CSS transitions instead of rAF loops keeps it cheap on mobile, which was the actual selling point in 2018 and still holds up.

Last commit is December 2022 and the API predates hooks entirely — it's a class-based render-prop component (`<Animate show={} start={} enter={} leave={}>`), which will feel foreign in a modern hooks-first codebase and won't get a hooks-based rewrite. Built with `nwb`, a build tool that's itself unmaintained, so if you ever need to patch it locally, expect friction. No TypeScript definitions in the repo. The support channel linked in the README (Spectrum.chat) has been shut down since 2021, so 'ask us anything' is a dead link.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →