<?xml version="1.0" encoding="utf-8"?>

Accordions are design elements commonly used to expand and collapse content on a webpage or application. They function like a musical accordion, where sections can be compacted or stretched to reveal more information. This feature is especially useful for organizing large amounts of content in a limited space, making them a frequent choice for FAQs, forms, menus, and long lists.

Well-designed accordions are an asset to UI because they allow users to quickly find what they need without overwhelming them with too much information at once.

Exercise #1

Collapsed state

Collapsed state Bad Practice
Collapsed state Best Practice

An accordion menu typically starts in a collapsed state, meaning the content is hidden and requires a click or tap to expand. To indicate that more content is available, symbols like a plus (+) icon or a right arrow (→) should be used next to each expandable item. This allows for a cleaner appearance while still offering additional information for those interested.

Exercise #2

Expanded state

Expanded state Bad Practice
Expanded state Best Practice

Think of a collapsed accordion menu as labeled drawers — each label gives a hint of what's inside. When a user expands the menu, it serves its primary purpose — to unveil the full content and allow users to explore in-depth.

Use a plus sign (+) or down arrow (⌄ or ▼) to show a collapsed section. When the section is expanded, switch to a minus sign (−) or up arrow (⌃ or ▲). This tells users that the content is visible and can now be collapsed.

Pro Tip: Deviating from familiar icons can confuse users about the menu's expandability, leading to frustration, so stick to widely recognized ones.

Exercise #3

Communicate interactivity with the hover state

Communicate interactivity with the hover state Bad Practice
Communicate interactivity with the hover state Best Practice

The hover state is activated when users move their cursor over an interactive element, effectively signaling, "This is clickable!" To ensure clarity, provide at least two visual cues indicating the component's hover state. A combination of a pointer cursor and a color change, for example, is sufficient to convey the element's interactivity.

Exercise #4

Add enough space between containers

Add enough space between containers Bad Practice
Add enough space between containers Best Practice

Each accordion section's container should be spacious enough to make the content scannable. Ample spacing is also essential for creating accessible and comfortably large clickable areas, enhancing usability.

On mobile devices, ensure touch targets are especially user-friendly with a recommended minimum height of 44 pixels, adhering to accessibility standards.[1]

Exercise #5

Keep sections simple in style

Keep sections simple in style Bad Practice
Keep sections simple in style Best Practice

Styling the content area of an accordion section similarly to the rest of the design maintains consistency and reduces confusion. To differentiate the content from the title, simply use a distinct font style to indicate hierarchy without overwhelming users.

Avoid cluttering with non-essential links, buttons, or additional subsections inside the content area, as this can make the interface complicated and challenging to navigate.

Exercise #6

Select the accordion behavior depending on users' needs

Select the accordion behavior depending on users' needs

Commonly, you can only open one section at a time with an accordion. When users click another section, the open one collapses automatically. This reduces user actions so they don't need to close it manually, and keeps the page uncluttered. The downside to this behavior is that users cannot compare content across multiple sections simultaneously.

Avoid automatic collapsing and keep all sections expanded by default. Scrolling is much easier and requires less cognitive load than clicking a section each time you need to recall the information.[2] Automatic collapsing is only safe when there aren't many sections, and users don't need to jump over the page scrolling up and down. Providing a Collapse All/Expand All button can enhance usability for accordions with many sections.

Exercise #7

Indicate section state

Indicate section state Bad Practice
Indicate section state Best Practice

Upon expanding an accordion section, a subtle yet distinct color or style change can effectively indicate its active state. The background or text color might shift to a different shade or a completely new color, distinguishing the expanded section from the others.

Additionally, stylistic alterations such as bolder text or more pronounced borders can draw attention to the active content. These visual cues should be both consistent across all sections and subtle enough to maintain the overall design integrity, ensuring an intuitive and clear navigation experience for users.

Exercise #8

Align icons consistently

Align icons consistently Bad Practice
Align icons consistently Best Practice

The placement of icons on either the left or right side of an accordion section has a minimal impact on functionality, but consistency in their placement is crucial.

By positioning the icons uniformly — either all on the left or all on the right — across each section, users can scan the menu smoothly without the visual interruption of zigzagging lines. This prevents eye strain and cognitive overload, as users don't have to adjust to different placements with each new section.

Pro Tip: Make sure the whole section is clickable/tappable and not just icons.

Exercise #9

Maintain typographic hierarchy

Maintain typographic hierarchy Bad Practice
Maintain typographic hierarchy Best Practice

Properly styled headings are vital in creating a clear type hierarchy within accordions, guiding the reader's eye to the start and end of each section while providing visual breaks between them.

To optimize their effectiveness, headings should distinctly stand out from the body text. Employ strategies like using a larger font size, a different typeface, capitalization, or a bolder font-weight to make them noticeable.

However, balance is key — ensure these titles are eye-catching without dominating the page. This not only enhances readability but also contributes to a well-organized and aesthetically pleasing design.

Exercise #10

Provide descriptive headings

Provide descriptive headings Bad Practice
Provide descriptive headings Best Practice

Headings in accordions are like signposts guiding users through content. Clear, informative headings are essential; they need to be both descriptive and enticing, encouraging users to explore further. Remember, when content is hidden within accordions, it risks being overlooked. To ensure your headings resonate with users, consider these tips:

  • Keep them concise and to the point.
  • Use language that speaks directly to users' needs.
  • Incorporate keywords for easy scanning.
  • Ensure they accurately reflect the content within.

Research plays a crucial role here. By understanding what matters to your users, you can tailor headings to their preferences and questions, making your accordions not just a design element, but a valuable, user-focused tool.

Exercise #11

When to avoid accordions

When to avoid accordions

Accordions aren't always the best choice, especially when users are likely to need access to most or all of the page's content. In cases where comprehensive information is crucial, presenting all content at once is preferable. Don't stress over page length; relevance is key. Avoid making users click through accordions unnecessarily, especially if they intend to consume all content in one go. When the content is related, relevant, and well-formatted, users will happily scroll.

For extremely lengthy pages, accordions may not be ideal. Consider alternative navigation, like splitting content across several manageable sections or pages, but avoid over-fragmenting into too many short pages.

If accordions are used, ensure they allow multiple sections to be open simultaneously for easy access to various content parts. The state of each section (open or closed) should persist based on user interaction.

Complete this lesson and move one step closer to your course certificate