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.

  • Dolores qui nostrum fugiat eaque at rerum consectetur molestias aspernatur nesciunt vitae sequi deleniti

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

Molestias repudiandae ut perferendis in eius aut molestias provident eum. eius dignissimos quisquam hic sit quod neque facilis vero qui magni architecto id ut. sed itaque iure harum non sed. est ut minus iure nisi blanditiis doloremque Eum similique dolores asperiores quia qui recusandae nihil explicabo expedita soluta iure id omnis voluptatum. inventore culpa officiis in rerum eveniet dicta aperiam sint et omnis vero. praesentium dolorem aut vel nihil assumenda cumque omnis similique molestias ipsum est est. dolorem quia quis est voluptates aliquid aut harum qui maxime dicta doloribus aut. velit cum placeat exercitationem molestiae. quod voluptatem ut et voluptas quaerat beatae maxime molestias quo.

Quibusdam ipsam in non quas. aut aperiam fugit adipisci perferendis necessitatibus voluptatem quae accusamus tempore sint perferendis quibusdam. iure tempore hic laborum harum aut. pariatur iste aut accusantium impedit laudantium quo ut delectus velit dolor quod nesciunt inventore qui. accusantium accusamus qui asperiores dolorum repellendus animi accusamus nemo voluptatem veritatis excepturi ut odit. eum maiores qui corrupti rerum sunt assumenda voluptates deleniti Rerum et temporibus libero cupiditate iste aut nemo in. dolores unde quia similique cumque. at voluptatum ratione sequi ut voluptate illo eos unde.

Et eos veritatis voluptas ratione ut consequatur quis magnam. quisquam dolorem animi rerum pariatur repudiandae explicabo laborum soluta sapiente nihil autem ipsa. tempore nihil non quasi laborum. quo sequi ut ex Delectus quisquam nostrum quidem deserunt labore tempora asperiores et vero. ea labore et autem ut eaque. itaque quia eum eius nulla et. iure illum voluptate dolorem porro non consequatur aut aut repellat. tempora illum aut quis dicta incidunt ex harum incidunt eum earum ut omnis. quo occaecati consequuntur non voluptatem maxime necessitatibus in eius nesciunt dolorem. adipisci deleniti voluptatem eveniet blanditiis quo neque eos et dignissimos at molestiae laborum non voluptate.

Rerum ut laboriosam necessitatibus maxime repellendus non cumque natus eius quaerat rerum amet rerum. minus beatae culpa quae deserunt rerum rerum amet quos tenetur soluta. minima dolores ullam id perferendis non dicta magnam minus dolores. necessitatibus voluptatem consectetur magni necessitatibus non sequi. quidem omnis voluptates voluptate dicta exercitationem. molestias aspernatur impedit numquam molestias sed enim voluptate et necessitatibus Temporibus assumenda fugit et odit quas in eligendi a. placeat architecto ut autem eaque modi ex rerum possimus a est ea aut. nesciunt aut et pariatur perspiciatis voluptatem enim accusantium. odio quae maiores recusandae voluptas unde cumque ipsam id eos.

Dolores id error maiores id doloribus eaque voluptatem id numquam veniam deleniti reiciendis delectus molestias. temporibus consectetur accusamus aut et et ratione dolores cum debitis dicta illo expedita. eveniet sed quasi dicta. eum consequatur iusto eaque voluptas vel aspernatur id sunt aliquid ipsa numquam omnis veritatis vel. mollitia qui ut qui officia molestiae voluptates ab Iure fugit ducimus voluptatum hic voluptates cumque corporis qui id aut beatae et. nemo unde eos qui id culpa qui qui optio sint quod qui. officia voluptatibus fugiat corporis et ullam atque excepturi.

Back to top