Accordions

Overview

What's an accordion?

An accordion is a useful tool in managing the content on a web page. It lets us take a page which might otherwise be overwhelming and break it down into manageable blocks for our users, like this:

Why does it matter?

When users engage with our content, they're trying to achieve a goal; this could be to find some information or apply to university.

As UX professionals, content writers, designers, and developers, our aim is to help the user achieve that goal as quickly and easily as they can.

We want our users to find the content that they’re interested in without having to scroll through a huge amount of information that’s not relevant to their current goal.

We don't want to waste their time and energy by asking them to scroll around, potentially distracting them from achieving their goal.

The question to keep in mind when deciding whether to use an accordion is: why do we need to fold this bit of content away at this point in time? Does it help or hinder the user?

Accordions are most suitable when people only need a few key pieces of content on a single page. By hiding most of the content, we allow users to spend their time more efficiently and focus on the topics that matter to them.

Nielsen Norman has recommended several different approaches to using accordions on complex content pages.

page comparison when accordions are used

Figure 1. Size of the terms and conditions page without accordions and after redesign using accordions.

Does it have accessibility benefits?

Users with cognitive conditions such as autism and dyslexia appreciate text that is succinct and well-structured – they don't want to be confronted by a wall of text.

Users with visual impairments may have a better experience with accordions in place – accordions often have large descriptive headings, enabling the user to orient themselves more easily with the page. Accordions can also provide users with larger target areas to select.

Are there accessibility concerns?

A user should always be able to tab through page elements, enabling them to access the content with a screen reader if needed.

Labels should clearly indicate the nature of the content in the accordion, so users can decide whether to expand that section or not.

Form fields, particularly mandatory ones, should not be contained within accordions. Users – particularly those using assistive technology – may miss them, or become disoriented within the page.

Accordions in the design framework

Design

We have used left aligned chevrons in the accordion pattern:

We use a '+' elsewhere in DF to denote the ability to add something to a page, so a chevron is visually distinct from this.

Research has shown that users react more quickly to left aligned accordion actions – users are more inclined to click the label, and have a larger target area to aim for.

We have stripped the colour out of accordions in this release. This is part of a step change process to develop the implementation of colour across the UCAS' digital estate.

Future releases may reintroduce elements of colour to accordions, and requests to do so should follow the design framework process.

Rules/guidelines for using accordions

These must be applied, for the most suitable and consistent experience:

Content

Accordions should be used for small amounts of content. They are not designed for more than a couple of paragraphs or so.

Nielsen Norman has recommended text should be concise, scannable, and objective to increase usability – this is no different for content inside accordions.

If you're using an accordion to hold more than three paragraphs, consider rewriting or regrouping the content to make it more manageable for users.

Buttons should not be placed inside the body of an accordion – as mentioned in the accessibility section above, these can be lost by all users and challenging for those using assistive software.

Grouping

When you're structuring content, consider how the accordions will be grouped on the page to make the best use of the design pattern.

No more than seven accordions should be stacked together, and accordions shouldn't be used in isolation on a content page (although they are successfully used on their own across AMS).

A maximum of ten accordions can appear on any content page, but this maximum should only be used in rare cases. If you're approaching this number of accordions for your content, there should be a thorough review of the content and its layout to ensure it is of maximum benefit to the user.

There are two distinct cases (terms and conditions, and FAQ pages) where you may see accordions in much larger numbers. However, these are unique content types and this pattern should not be replicated elsewhere.

example of FAQ accordion

The expand all/collapse all buttons should be used for groups of accordions together, and should not be used if there are large amounts of text on the page between individual accordions.

Accordions should not be nested – current design patterns for nested accordions are to be used for legacy content only.

You might like to read

Patterns in action

Default accordion

Default layout and behaviour with optional expand/collapse controls.

To enable or disable the expand/collapse controls simply set the data-accordion-controls attribute to true|false respectively.

Highlight accordion with toggle

To add a highlight to the accordion control tabs simply add the accordion--highlight class to the enclosing ul.

To enable toggling behaviour, add the attribute data-accordion-mode="toggle" to the enclosing ul

Accordions with buttons

You can add small buttons to any accordion__toggle element by adding the class accordion__toggle--buttons. You should also wrap the text and button(s) inside the accordion__toggle with <span> tags to maintain the text underline on hover and maintain their alignment when one or more buttons are used.

If you would like the buttons to be on the right of the accordion__toggle simply add the class accordion__toggle--buttons-right.

Please make sure you prevent propagation of any click event on buttons used to prevent them triggering the show/hide of the accordion.

  • Minus autem suscipit odit et et est pariatur accusamus

Accessibility

To ensure accordions remain accessible to screen readers and alternative input devices please pay close attention to the markup examples and refer to the documentation for explanation.

Accordions within prose

Iusto esse vel in sed velit velit aut iusto facilis quas qui. aut cum ut natus fugit et ut est. asperiores nulla nisi tenetur perspiciatis quaerat. dolorum molestias explicabo id fugit expedita esse aspernatur dolorem voluptate. iure esse velit rerum consequatur qui sit ad occaecati quam ea mollitia consequatur Odio reprehenderit consectetur delectus commodi laboriosam numquam sint ut laborum nihil quo non ea ut. earum adipisci molestias voluptas eum ut molestias possimus quo nostrum provident et et et. qui commodi minus perferendis ad maiores nisi modi odit voluptatum necessitatibus. libero qui voluptatibus veniam molestias maiores distinctio reiciendis commodi eum voluptates tenetur optio cum quis.

Quidem non reprehenderit facere veniam voluptatibus id officiis sit possimus voluptate sed dolores consequatur. veritatis nobis quis qui ut eveniet voluptas voluptatem eos et quos. nulla aut error nobis. voluptatem natus itaque magni nostrum. enim illo placeat dolor est nam incidunt. provident hic mollitia dignissimos aliquid eos dolores dolore officiis qui accusamus Aut ea et omnis est quo rerum sed omnis. officiis quasi provident et aperiam alias. aut eligendi illum cum est ut voluptatibus iure fuga et sed magnam quo illo. iure dolor mollitia deleniti quidem quas et voluptatem et quia quia ut qui. quis ut facere autem in eos earum sed cumque aperiam exercitationem quis.

Ea ut nemo cupiditate et et sit earum in occaecati. expedita dicta sed id dignissimos nesciunt sit. vitae et ad similique ad libero ut ea fuga officiis qui doloremque sit. blanditiis aut est accusantium eum alias aut. ut consectetur pariatur quo in accusamus accusamus est dolores distinctio. maxime voluptatem voluptatem et nihil modi veniam voluptatem iure fugit Quia officiis consequatur facilis ut soluta quasi maxime officia sit. dicta quaerat sed tempore et repellendus sit nihil aut sequi perspiciatis. deserunt minima est et.

Nisi fugit et iste culpa nulla totam tenetur earum tenetur. voluptate autem velit et tempore. accusamus id ut ullam Non odit non doloribus officia veniam consectetur fuga. doloribus reiciendis beatae modi hic occaecati cupiditate aut aut ut natus est dolorem ullam. excepturi illo quo sint et quis maiores sunt eligendi. culpa omnis et iste labore et doloremque blanditiis mollitia aliquam eos officia ipsum qui velit.

In modi laboriosam velit voluptas facilis molestiae consectetur saepe quaerat est sequi quia velit. quis dolores doloribus et est atque corrupti dolores porro. occaecati et nihil consequatur repellat repudiandae incidunt qui velit ducimus beatae ducimus ut reprehenderit omnis. repudiandae explicabo corrupti impedit voluptas iusto cum omnis exercitationem quaerat ut et neque quam. est repudiandae ex architecto vitae Temporibus est eos tempora est doloremque esse quae similique molestiae mollitia quia reprehenderit alias sunt. inventore labore consequatur impedit quas hic libero et sapiente reiciendis odit corrupti sit quas. aliquid sit voluptatum rem et dolor exercitationem. nihil quis asperiores explicabo molestias ex eligendi. voluptas nisi dicta distinctio consequuntur et omnis esse a unde reprehenderit cupiditate eos aut nesciunt. ea sit sunt tempora repudiandae debitis odit sint adipisci. impedit similique omnis cupiditate eaque culpa laborum aut itaque est qui laborum labore reiciendis qui.

Back to top