Accordions

These accordions have been created using javaScript, jQuery, HTML and CSS. The neccessary code is shared below.

The accordion is created with a button using class accordion.

When to Use

Accordions help with cognitive load on pages where there is a lot of content that for some reason cannot be separated onto multiple pages.

With accordions the user in charge of showing the content, and can choose only the content they are interested in.

Accordions should only be used when a minimum of three will be needed. Expand and collapse buttons should always be used.

Example

“Wars not make one great.”
--Yoda (Star Wars: Episode V — The Empire Strikes Back)
“Governor Tarkin! I should have expected to find you holding Vader's leash. I recognized your foul stench when I was brought on board.”
--Princess Leia Organa (Star Wars: Episode III — A New Hope)
“The ability to destroy a planet is insignificant next to the power of the Force.”
--Darth Vader (Star Wars: Episode V — The Empire Strikes Back)

Code

The code sample below allows you to quickly implement accordions into your prototype.

Last Modified: June 2, 2025