Accordions included with Clojurescript

Google closure is a treasure-trove of little-known features that are all included with Clojurescript by nature of its using Closure. Never bother with an accordion plugin again.

2 Likes

:slight_smile:

With reagent and like two-three lines of CSS3 it’s usually so simple for me that I don’t bother using such a native class for it.

Just toggle a class on a container div using a reagent atom for storing state of a section. Use css to animate it downwards and upwards.

having said this: will check out this treasure trove 'cause why not :slight_smile:

True – I’ve done that too with an easy Reagent function. I’ve found the writing of those css lines to be annoying, though. Plus, the Google Closure method has support for things like “only one is allowed to be open at once,” plus any other toggle or on-expand logic. Closure will also provide me with things I hadn’t thought of, like the ARIA role. Check it out:

https://google.github.io/closure-library/source/closure/goog/demos/zippy.html

And the docs: https://google.github.io/closure-library/api/goog.ui.AnimatedZippy.html