Accordion
On this page
Overview
Organizes content into expandable panels for scanning and selective
disclosure. Must contain paired rh-accordion-header and
rh-accordion-panel children. Should have two or more pairs; for a
single section use rh-disclosure. Headers use ARIA role="heading"
with aria-expanded/aria-controls for screen readers. Supports
keyboard navigation: Tab to move focus, Enter or Space to toggle.
Edit element properties
import '@rhds/elements/rh-accordion/rh-accordion.js';
<rh-accordion>
<!-- H2 tags will be removed on upgrade, rh-accordion-header will set the correct heading level internally using the header tag that wraps it -->
<h2><rh-accordion-header>Item One</rh-accordion-header></h2>
<rh-accordion-panel>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</rh-accordion-panel>
<h2><rh-accordion-header>Item Two</rh-accordion-header></h2>
<rh-accordion-panel>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</rh-accordion-panel>
<h2><rh-accordion-header>Item Three</rh-accordion-header></h2>
<rh-accordion-panel>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</rh-accordion-panel>
</rh-accordion>
import { Accordion } from "@rhds/elements/react/rh-accordion/rh-accordion.js";
import { AccordionHeader } from "@rhds/elements/react/rh-accordion-header/rh-accordion-header.js";
import { AccordionPanel } from "@rhds/elements/react/rh-accordion-panel/rh-accordion-panel.js";
// NOTE: React 19+ does not require these wrapper imports.
// You can use the custom elements directly as-is.
export const Demo = () => (
<Accordion>
<h2>
<AccordionHeader>Item One</AccordionHeader>
</h2>
<AccordionPanel>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</AccordionPanel>
<h2>
<AccordionHeader>Item Two</AccordionHeader>
</h2>
<AccordionPanel>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</AccordionPanel>
<h2>
<AccordionHeader>Item Three</AccordionHeader>
</h2>
<AccordionPanel>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</AccordionPanel>
</Accordion>
);
Position of accent slot content relative to the header title.
Defaults to inline. Use bottom when accents are numerous or
the title needs more horizontal space.
Switches the accordion to large size, increasing font size and padding.
Avoid on viewports below 576px; the accordion automatically falls back
to small size on mobile breakpoints. Use large for page-level content
sections where the accordion is the primary content structure.
Color palette for the accordion and its child headers and panels. Must match the surrounding surface color to ensure adequate text contrast. Avoid mixing light and dark palettes within the same page section.
Comma-separated 0-based indexes of initially expanded panels.
Defaults to none (all collapsed). Example: expanded-index="0,2"
expands the first and third panels.
Status
- Figma library:
-
Ready - RH Elements:
-
Ready - RH Shared Libs:
-
Ready
When to use
- When space is at a premium and content cannot be displayed all at once
- When you need to condense a large amount of related information into sections
- When you need a way for users to read or compare sections of content simultaneously
Status checklist
| Property | Status | Meaning |
|---|---|---|
| Figma library |
|
Component is available in the Figma library |
| RH Elements |
|
Component is available in RH Elements |
| RH Shared Libs |
|
Component is available in RH Shared Libs |
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.