We’re going to build an official Accordion component that ships in Elements… but, I was just playing around with a custom component this morning and thought I’d share it here to get some conversation going around what people actually want/need from such a component.
I think something like the above with a few more styling controls would be all that’s required for an Accordion, right?
I think they’re quite similar. I’ve only set up the header and the content section as separate elements so that additional styling can be applied (in this example, the content section is smaller, creating an extra effect).
This would provide basic support for an accordion and much appreciated.
The one feature I did not see that I think is essential for something like this, is support for there only being one item expanded at a time. If there is one open and you open another it closes the original that was open.
This is a common feature in this type of component and something I rely on all the time. It might have been present in your example but I did not see it.