The Barebones Of An Accordion

Highlighting important details of a section and revealing more details upon a tap or click, if necessary.


When and how it should be used?

An HTML accordion is a type of user interface component that allows content to be collapsed and expanded in a space-saving way. It is typically used when there is a lot of content to display, but the available space is limited.

What's an accordion?

The accordion is a graphical control element comprising a vertically stacked list of items, suck as labels or thumbnails. An accordion is similar in purpose to a tabbed interface, a list of items where exactly one item is opened into a panel.

What if the user clicks on a collapsed card while another card is open?

If a user clicks on a collapsed card while another card is open in an accordion, there are several ways to handle this interaction. Here are a few possible options:

Close the currently open card: If the user clicks on a collapsed card while another card is open, you can choose to close the open card and expand the one the user clicked on. This ensures that only one card is open at a time, which can help prevent clutter and confusion.

How to choose an icon to indicate the expansion?

When choosing an icon to indicate expansion in an accordion, you want to choose an icon that is clear and easy to understand. Here are a few tips to keep in mind:

Use a plus/minus icon: One of the most common icons used to indicate expansion is a plus or minus icon. A plus icon typically indicates that the content can be expanded, while a minus icon indicates that the content is currently expanded and can be collapsed.