Accordions are collapsible content sections. They can be used individually or grouped together.
data-accordions{% include "website/components/shared/accordion.html" with
id="1"
title="Your Question Here"
description="Your answer content here"
open=False %}
<div data-accordions>
{% include "website/components/shared/accordion.html" with
id="1"
title="First Question"
description="First answer"
open=False %}
{% include "website/components/shared/accordion.html" with
id="2"
title="Second Question"
description="Second answer"
open=False %}
</div>
For accordions that should only collapse on mobile (but not appear as an accordion on desktop):
<div data-accordions data-accordions-mobile-only>
{% include "website/components/shared/accordion.html" with
id="1"
title="Section Title"
description="Content that stays open on desktop"
open=False %}
</div>
Features:
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Unique ID for the accordion (used for ARIA attributes) |
title |
string | Yes | The heading/button text |
description |
string | Yes | The content shown when expanded |
open |
boolean | No | Whether accordion starts open (default: False) |
For a working example see the FAQs on the homepage.
initializeAccordions() function finds all [data-accordions] containersui/website/css/shared/accordion.css handles the animationsThe accordion component comes with comprehensive built-in styling in ui/website/css/shared/accordion.css. This includes:
You typically won’t need to add custom CSS unless you want to override specific styles. The accordion will look consistent across all pages.
The accordion uses a CSS Grid-based animation technique for smooth open/close transitions. The panel uses display: grid with grid-template-rows: 1fr when open and 0fr when closed. CSS transitions animate between these states, and overflow: hidden ensures clean clipping. This approach works with any content height without needing to calculate dimensions.
ui/website/components/shared/accordion.html (included as website/components/shared/accordion.html)ui/website/css/shared/accordion.cssui/website/js/components/accordions.js