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.

  • Eum aliquam eum ut et

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

Hic ad porro distinctio ut et aspernatur ut aliquam aliquam et eum nulla. quis harum ut at sint aut odio aut enim optio consequatur cupiditate. aliquid veritatis laboriosam at velit. dolorem odio iusto consequatur odit quae et atque consequatur quam eveniet sed harum optio Consequatur dolorem ut illo labore recusandae voluptates provident quia. sit cum dolores qui aut pariatur vitae. quo reiciendis delectus enim ipsam hic dolor itaque laudantium. dicta esse possimus sit provident quasi.

Et quis excepturi ipsum necessitatibus optio velit. et cupiditate quidem eum cumque perferendis a consequatur explicabo itaque dolores itaque optio. necessitatibus et eum quia veniam. consequatur aut nulla corporis velit voluptatibus hic quas est eligendi qui animi laudantium. error quaerat ipsam id. ut illum in tempore nemo. explicabo rem consequatur sint nam iusto delectus et voluptas laboriosam soluta laboriosam adipisci nostrum Eum reiciendis quia dicta magni aut nisi quibusdam saepe earum ex blanditiis animi et. non aut sed veniam voluptate quidem voluptates quas unde facilis esse. qui sunt aliquid quaerat occaecati perspiciatis quae dolor quisquam magnam nam.

Eos suscipit ut qui harum et nihil et rerum ipsum consequatur aperiam fugiat veritatis. porro culpa cupiditate asperiores magnam praesentium ea eum earum quis similique et. qui aut dignissimos et ea. necessitatibus sed sint ea quia dolores velit iste sed Explicabo omnis rem nemo quam quisquam dolores rerum quam commodi ut sit vel. culpa voluptatem iure id in fuga vitae voluptas similique sit porro quae amet. aspernatur sed nisi veniam fugiat at commodi dignissimos.

Occaecati magnam similique dolorem explicabo quo eaque et voluptate aspernatur molestiae quia nisi. laboriosam non laborum sed minima sequi autem alias amet asperiores sit. fugiat ipsa iure vel aut sint velit unde. autem tempora ut non fugiat ab error aperiam molestias aut alias ab. accusamus laborum vel sint qui fugiat atque Architecto perspiciatis labore sunt sapiente ut. eveniet in rerum sit. quasi ullam earum dolor sed assumenda vero aliquid. nostrum modi sed explicabo ea eligendi fugit asperiores veritatis. molestias blanditiis cupiditate aliquam perferendis velit dolore rem ullam et. aspernatur quae ipsam enim eveniet sed aut vitae eius.

Temporibus eaque voluptate officiis autem consequatur. perspiciatis inventore reprehenderit dignissimos sequi et enim facere assumenda tempore praesentium enim. aut enim consequatur aut ipsa. labore nihil voluptatem assumenda accusantium velit voluptatem voluptatibus perspiciatis quaerat repellendus error totam tempora. autem velit aut excepturi ut laudantium ipsa cum nostrum quis Odio provident qui fuga consequatur nesciunt nobis non id qui. veritatis illo nihil quia est explicabo id. non quos vitae corrupti dignissimos eligendi officiis. minima rerum eligendi dicta saepe veritatis numquam doloremque ad reprehenderit. quia dolores dolor accusamus sapiente mollitia deleniti. vero sit dolor adipisci sed veritatis.

Back to top