Single accordion
I am an Accordion.
I am an Accordion.
You can put any content in here, including other components, like code:
HelloWorld.java
Accordion example
Accordion groups
Group related accordions together using<AccordionGroup>. This creates a cohesive section of accordions that can be individually expanded or collapsed.
Getting started
Getting started
You can put other components inside Accordions.
HelloWorld.java
Advanced features
Advanced features
Add icons to make accordions more visually distinct and scannable.
Troubleshooting
Troubleshooting
Keep related content organized into groups.
Accordion Group Example
Deep linking
Each accordion generates an anchor based on itstitle (or a custom id). When a user opens an accordion, the URL updates with the anchor hash and is copied to the clipboard. Navigating to a URL with an accordion’s hash automatically opens the accordion and scrolls it into view.
For nested accordions, the hash uses a : separator to represent the hierarchy. For example, #parent:child opens both the parent and child accordions.
Nested accordions
You can nest accordions inside one another. Child accordions work independently from their parent, supporting deep-linking through the full nesting path.Parent accordion
Parent accordion
Nested child accordion
Nested child accordion
This content is inside a nested accordion.
Nested accordion example
Properties
Title in the Accordion preview.
Detail below the title in the Accordion preview.
Whether the Accordion is open by default.
A custom ID for the accordion used for anchor linking. If omitted, a slug is generated from the
title.The icon to display.Options:
- Font Awesome icon name, if you have the
icons.libraryproperty set tofontawesomein yourdocs.json - Lucide icon name, if you have the
icons.libraryproperty set tolucidein yourdocs.json - Tabler icon name, if you have the
icons.libraryproperty set totablerin yourdocs.json - URL to an externally hosted icon
- Path to an icon file in your project
- SVG code wrapped in curly braces
- Convert your SVG using the SVGR converter.
- Paste your SVG code into the SVG input field.
- Copy the complete
<svg>...</svg>element from the JSX output field. - Wrap the JSX-compatible SVG code in curly braces:
icon={<svg ...> ... </svg>}. - Adjust
heightandwidthas needed.
The Font Awesome icon style. Only used with Font Awesome icons.Options:
regular, solid, light, thin, sharp-solid, duotone, brands.