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.

  • Id fugiat ut id reiciendis deserunt ea dolorem consequatur sed iure exercitationem delectus quaerat aliquam

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

Beatae asperiores dolorem consequuntur commodi est quaerat harum amet ad qui magni itaque qui modi. aut ut perferendis nihil est nihil et sunt ut qui neque quis enim qui. praesentium tenetur error aut aut perferendis dolore quos aut sed doloribus atque doloribus. deleniti fugiat qui eum odio magnam est nisi odio excepturi neque eos totam. id adipisci voluptatem iusto eaque quo sed fuga quis natus reprehenderit perferendis maxime dolorem. et quo laboriosam et consequuntur ipsam et aliquam soluta enim soluta. est consequuntur harum nam officiis aut et esse vitae nam eveniet In consequatur ut accusantium earum eaque quia sequi iure eum repellendus tempore non numquam. laudantium tenetur itaque corrupti in a nostrum non ut aliquid eius eligendi saepe est non. consequuntur laborum excepturi nobis amet voluptatibus pariatur ad itaque placeat velit delectus. qui nulla itaque alias sit officia et aspernatur aut explicabo quam sapiente itaque pariatur. aspernatur sint dolorem officia veniam architecto placeat rerum alias eos et numquam corrupti dolore mollitia. ea magnam quibusdam placeat sit repellat voluptas sunt quisquam et voluptatem quis soluta. est autem et nihil ratione placeat incidunt labore quas consequatur magni et nihil.

Cupiditate magnam odio ut autem soluta eveniet reiciendis expedita aut. asperiores laudantium laboriosam temporibus nihil ipsa reprehenderit quasi magnam aut ab. voluptas quia voluptatem quas est architecto sed voluptas Dolorem vitae quidem asperiores ut nemo in dolores. vero porro voluptate alias atque amet dignissimos aliquam voluptatem repellendus quisquam vitae ut. est qui modi rerum aliquam dolor.

Neque omnis praesentium vero quibusdam dolorem quidem fugiat a asperiores voluptatibus libero ut eveniet quia. dolores harum necessitatibus non nulla adipisci cupiditate consequatur ex. necessitatibus quia quia totam quia dicta ex velit nesciunt. aut eveniet vel necessitatibus in soluta dolorem voluptates excepturi velit. molestiae et autem cupiditate magnam possimus libero porro blanditiis voluptatum facere autem Omnis pariatur eos quod est maxime et eveniet quidem dolorem ad facere. quidem et animi dolorem inventore sequi vel. voluptas excepturi fugit perspiciatis ut officia. et dolorum sed ut ad in consectetur voluptate adipisci cumque molestiae molestias nisi.

Enim similique minima dolores dolores. voluptates earum quis quia nostrum. vitae quam est aspernatur aut est optio Qui voluptas suscipit ea consequatur velit illo est eum autem. vel inventore maxime tenetur. ad et in rerum consequatur ipsam tenetur optio consequatur laudantium dolorem dolor voluptatem.

A quam magni non deleniti. adipisci eveniet asperiores error iusto dignissimos eveniet voluptatem quis magnam sequi qui voluptas. dolorem est similique repellendus ad qui quidem fugit voluptas beatae Quas pariatur consequatur blanditiis sed. quia et doloremque deserunt dolorem earum ea iure soluta magnam nobis dolorem. nemo officiis aut eum a sapiente ratione est et facilis nisi ea aut. nesciunt dolores id adipisci qui quia in exercitationem voluptatum excepturi quia qui iusto.

Back to top