An accordion is made up of one
<Accordion> component wrapping one or more
<AccordionItem> components. See the sections below for information on each.
|Applies a border to the accordion content.|
|Class to be applied to the outer |
|Class to be applied to the header |
|Class to be applied to the content |
|Boolean to expand the accordion.|
|Text for the accordion item heading.|
|Heading type to override default |
|If not provided, a unique id will be automatically generated and used.|
|Sets the accordion panel's open state. Use this in combination with |
|A callback function that's invoked when a controlled accordion panel is selected or deselected.|
|Icon to overwrite default close icon|
|Icon to overwrite default open icon|
The following CSS variables can be overridden to customize Accordion components:
- Use an accordion to see an overview of multiple, related sections of content
- Use an accordion to show and hide sections as needed
Accordions hide content from users and not everyone will notice them or understand how they work. Accordions increase cognitive load and interaction cost, as users have to make decisions about what headers to click on.
- Don't use an accordion if users need to see most or all of the information on a page.
- Don't use an accordion if there is not enough content to warrant condensing.
- Make the entire header selectable. Allow users to click anywhere in the header area to expand or collapse the content; a larger target is easier to manipulate.
- Give interactive elements enough space. Make sure interactive elements within the collapsible region are far enough from the headers that users don’t accidentally trigger a collapse.
Keyboard support for the Accordion header includes:
Spacebar- Changes the collapsed/expanded state of the associated accordion panel
Arrow Down- Moves focus to the next accordion header
Arrow Up- Moves focus to the previous accordion header
For more information about how we tested and validated our work for each checklist item, read our component maturity documentation.
ColorMeets AA color contrast standards for accessibility and color blindness.Complete
Forced Colors Mode (FCM)While using FCM the components text is legible and improves readability.Complete
WCAG 2.1 Level AA ConformanceAll Axe checks for WCAG AA compliance have passed.Complete
Screen readersVoiceOver, NVDA, and JAWS screen readers provide concise communication and interaction.Complete
Keyboard navigationComponent is fully navigable with a keyboard.Complete
StorybookComponent has stories to cover all defined props.Complete
ResponsiveComponent designed to work in all responsive breakpoints.Complete
Spanish translationsIncludes Spanish translations for default text content.Complete
CodeTokens implemented in code.Complete
DesignTokens implemented in the Sketch.Complete