A NSW Government website
Design System v3.24.0

Accordion

An accordion is a series of expandable vertical panels, designed to save space on a page by hiding content and revealing it as required.

Figma

Usage

Accordions can work well for people who use a service regularly, or who need to perform familiar tasks quickly.

Only use an accordion if there’s evidence it’s helpful for users to:

  • see an overview of multiple, related sections of content
  • show and hide those sections as needed

The details based accordion is the default and recommended implementation.

When to avoid

Test your content without an accordion first. Consider if it’s better to:

  • simplify and reduce the amount of content
  • split the content across multiple pages
  • keep the content on a single page, separated by headings
  • use a list of links to let users navigate quickly to specific sections of content
  • use the Tab component for users who need to switch quickly between 2 sections. Accordions push other sections down the page when they open, but tabs do not move which makes it easier to switch.

Do not:

  • use the accordion if the amount of content it would need to contain will make the page slow to load
  • use accordions to split up a series of questions into sections. Use separate pages instead
  • use with very short content, use lists or paragraphs
  • use with very long content, use tabs or separate pages
  • add any other UI elements within the header
  • use where important information can be hidden and missed
  • use an accordion to shorten a page.

Collapse all/Expand all

The optional collapse all/expand all functionality allows users to perform the action to all accordions, reducing time and clicks to reach the required information. It can be removed or added as required.

This function should not be used to help users locate information within accordions. If a user is expanding multiple accordions because they are unsure of the content they contain, consider more descriptive titles or removing accordions all together and displaying the content separated by headings.

Open accordion pane on page load

By default, all panes in an accordion are closed.

  • Details based accordion: add the open attribute to any <details> element that should start open. The progressive enhancement layer leaves the native open state intact, adds role="region"/aria-labelledby to the panel, and wires the optional toolbar when present.
  • Legacy JavaScript accordion: add the .nsw-accordion__open class on the .nsw-accordion__title element. Without JavaScript, all panel content remains visible. When JavaScript runs, it hides panels and reopens only those marked with .nsw-accordion__open, then keeps aria-expanded/aria-hidden in sync.

Principles

Use clear labels

Accordions hide content, so the labels need to be clear. Ensure the headings used are brief and explicit about what is contained in the hidden panel. Intuitive headings help the user build a clear mental model of the content.

Do not disable sections

Accordions can be set open or closed. They can be configured to only allow 1 panel to be open at a time. Do not use with only 1 panel allowed to be open at once, if people need to compare items in different panels.

Disabling controls is normally confusing for users. If there is no content for a section, either remove the section or, if this would be confusing for your users, explain why there is no content when the section is opened.

Consider tabs if the user would likely need to flick between content sections.

Details variation (Recommended)

The details based accordion (.nsw-accordion--details) is the default and recommended implementation. It uses native <details> and <summary> elements for the disclosure pattern, which provides built in semantics, keyboard support and state announcement for assistive technologies. This version delivers the core expand and collapse interaction without requiring JavaScript and is progressively enhanced when JavaScript is available.

Why we included it

  • Semantic and accessible: uses the browser's native disclosure control so screen readers understand the role and state without extra ARIA attributes.
  • No-JS friendly: the main interaction (opening and closing panels) works even when JavaScript is disabled or blocked.
  • Progressive enhancement: when JavaScript is present, we add ARIA region/label associations to panels and wire optional "Expand all / Collapse all" controls without changing the native open/close behaviour.
  • Future proof: relies on well supported HTML elements instead of hidden form controls, which reduces the risk of implementation errors by consumers.

Limitations and trade offs

  • Styling hooks are constrained: browsers retain some control over <summary> behaviour and markers. While the Design System normalises the visual presentation, very heavy or unusual customisation of the header or marker is not supported.
  • Animation support varies between browsers: smooth height transitions for opening and closing rely on newer CSS capabilities. Where these are not available, some browsers will fall back to instant open and close rather than an animated transition.
  • Focus treatment is container based: due to how <summary> receives focus, we apply focus styles at the header or container level. Implementers should avoid additional overflow or clipping on parent containers that would cut off the focus ring.
  • Programmatic control is limited without JS: to open or close panels in response to validation, routing or other application events, you must use the JavaScript progressive enhancement layer or the legacy JavaScript accordion.

How to use

  • Add the modifier class .nsw-accordion--details on the accordion container to render the details based variant.
  • Use <details> for each item and <summary> for the clickable header, following the markup in the examples.
  • Optional: add a toolbar container .nsw-accordion__toggle with "Expand all" and "Collapse all" buttons. When JavaScript is available, these controls are wired up automatically.

Compatibility and support

  • The details based accordion is recommended for most use cases because it combines strong accessibility with reduced JavaScript dependence.
  • Some advanced animation or styling requirements may not be achievable with <details> and <summary>. In those cases, consider the legacy JavaScript accordion.
  • The details variant can safely coexist on the same page with the legacy JavaScript accordion without conflict.

Legacy JS-core variation (Supported)

The legacy JavaScript accordion (.js-accordion) is the original implementation and remains fully supported for backward compatibility and when advanced programmatic control or legacy behaviour is required.

  • This version manages state entirely through JavaScript, handling aria-expanded and aria-hidden attributes and adding roles for assistive technology.
  • Without JavaScript, all panel content remains visible. On init, JavaScript hides panels and reopens those marked with .nsw-accordion__open, then keeps aria-expanded/aria-hidden in sync as users interact.
  • While this approach supports consistent behaviour across browsers, it introduces additional load operations that can affect performance compared to the details based solution.
  • This variant is supported for now but is planned to be sunset next year; prefer the details based accordion for new work.

Accessibility

All components are responsive and designed to comply with WCAG 2.2 AA accessibility standards. Full compliance depends on using and configuring the components correctly. The details based accordion is the default implementation and meets these standards when implemented as intended, and the legacy JavaScript variant can also meet these standards when used correctly, but relies on additional scripting.

Support for accessibility features

Details based accordion

Uses native <details>/<summary> for built-in semantics, keyboard support and state announcement. Works without JavaScript; the progressive enhancement layer adds panel region/label ARIA and wires the optional "Expand all / Collapse all" controls without altering the native open state.

Without JavaScript, the details based accordion remains keyboard accessible through the native <summary> element.

Legacy JavaScript accordion

Retained for advanced scripting needs. It manages state via JavaScript, handling aria-expanded/aria-hidden and roles. Without JavaScript, panel content remains visible; when JavaScript initialises it hides panels and reopens those flagged with .nsw-accordion__open, then keeps attributes in sync as users interact. This extra scripting can add load overhead compared to the details based approach.

Details variation (CSS-core)

Regular

Integrating content into agile workflows

Build content into the sprint from day one. Treat words as part of the product, not an afterthought. Add content tasks to the backlog and review them in stand ups alongside design and development.

Collaborate with product owners to define a clear Definition of Done for content. Encourage early reviews of copy within design critiques so language decisions move at the same pace as the interface.

  • Join daily stand ups and retrospectives to stay aligned
  • Include content tickets in sprint demos
  • Track feedback and updates using the same agile tools as your team
Designing simple paths through complex tasks

Start by naming the single outcome the user needs to achieve. Remove anything that doesn’t help them get there.

Structure the page like a conversation: set expectations up front, group related steps, and explain why you’re asking for information.

  • Lead with clear, task‑focused headings
  • Break long processes into confident, named steps
  • Use examples only where users typically hesitate
Partnering with subject matter experts

Make it easy for SMEs to help. Share a short agenda and a live doc. Ask them to walk a realistic scenario instead of describing the system.

Capture source links and who approved wording so changes are auditable. Follow up with a redline or prototype to make feedback fast.

  • Record facts with dates and owners
  • Translate jargon into plain language
  • Agree on the exact words users will see

Toggle controls (progressively enhanced)

Embedding content design in agile delivery

Bring content into every stage of the sprint, not just the end. Treat it like any other design asset: plan it, review it, and test it early.

When copy and interface evolve together, teams avoid last‑minute rewrites and mismatched intent.

Making complex information easy to follow

Help users reach their goal quickly. Use strong verbs and avoid multi‑step sentences that hide the action.

  • Cut instructions down to what matters
  • Show one decision at a time
  • Keep headings short and concrete

Sometimes a simple label swap or reordered field makes the biggest difference.

Collaborating with subject matter experts

Ask SMEs to explain how people actually use a service, not just how it works on paper. Listen for pain points or unclear language that can inform your content choices.

Keep notes visible to everyone so edits don’t get lost. A few short comments are better than one long document review.

Follow up with a quick playback—what you heard, what will change, and what stays the same.


Legacy variation (JS-core dependent)

Accordion with expand/collapse all

First Home Owner's Grant (New Homes) scheme (FHOG)

Buying or building your first home? You may be eligible for a $10,000 grant under the First Home Owner's Grant (FHOG) scheme.

This grant scheme only applies to buying or building a new home.

You can make a claim if:

  • your home is newly constructed and has a total value of less than $600,000
  • the land and the dwelling you intend to build has a combined value of less than $750,000.
HomeBuilder program

If you are building a new home, you could also be able to apply for the Australian Government grant of $25,000. To be eligible you must:

  • sign the contract between 4 June 2020 and 31 December 2020
  • commence within 3 months of the contract date.

HomeBuilder complements the NSW Government’s existing First Home Owner Grant and stamp duty concessions.

First Home Buyer Assistance scheme (FHBAS)

The NSW Government recently announced increased thresholds for purchases of new homes and vacant land to build a new home from 1 August 2020. The threshold for existing home purchases remains unchanged.

Simple accordion

Sprint cadence or workflow

In your team there may already be a sprint cadence that includes content design. Become familiar with agile practices such as the Kanban wall, daily stand ups and sprint planning. Understand the user journey and their needs. Get involved in usability testing sessions and iteration.

Otherwise, the content workflow may be separate from the product team. At the very least, make sure the team has real content to use, when they’re building a prototype. Also ensure your team uses real content when it does usability testing. Attend playbacks from this testing, to know how your content needs to change.

As well as designing the user experience with product team members, a content designer works to know the facts with subject matter experts.

Simplifying complexity

Your aim from the outset is to simplify everything for the user. Your main task will be to set up a clear path for them to achieve their goal.

Start with a user story. You should create one for each piece of content, from user research. If you’re part of a multidisciplinary product team, everyone is likely to be using them as you design and build.

A user story will help you to pinpoint the user need from the outset. It puts the user front-of-mind and gives you a focus when designing and writing the content.

Next, create a structure for your page, based on the user story. Write up meaningful H2 headers to serve as signposts to help the user do what they need to do.

Working with subject matter experts

Share your way of working with your subject matter experts – in person if possible.

They're a great way of introducing your approach to a subject matter expert, which may be completely foreign to them. It will show them how you're focusing on the user, and what you're trying to solve. Ask them for feedback. Find out if there’s anything missing and if you’re on the right track.