--- title: "Accordion" slug: accordion category: component type: documentation version: 20.0.0 tokens: 1693 source: https://ovh.github.io/design-system/v20.0.0/llms/react-components-accordion--documentation.txt --- # Accordion _An **Accordion** is a vertical header that reveals or hides an associated section of content._ ## Overview The **Accordion** component delivers large amounts of content in a small space through progressive disclosure. The header part gives the user a high-level overview of the content allowing them to decide which sections to read. **Accordions** can make information processing and discovering more effective. However, it does hide content from the users, and it\'s important to account for a user not noticing or reading all the included content. If a user is likely to read all the content then then the usage of an **Accordion** would not be recommended as it adds an extra interaction to access the content; instead use a full scrolling page with normal headers. | | | |---|---| | Name | Accordion | | Also known as | Collapsible, FAQ | | Design | https://www.figma.com/design/9jDDTcR4a9jPRFcdjawAlf/ODS---UI-Kit?node-id=1-6634 | | Source | https://github.com/ovh/design-system/tree/master/packages/ods-react/src/components/accordion | ## Usage Use any number of elements to visually display them as a group. Several collapsible panels can co-exist in a same interface. Use this component for : * Organizing related information * Shortening pages and reducing scrolling when content is not crucial to read in full * When space is at a premium and long content cannot be displayed all at once, like on a mobile interface or in a side panel ### Dos & Don'ts **Do** - Use Accordion to progressively disclose content, especially in long or dense pages - Ensure the summary/title of each Accordion clearly communicates what it contains - Use Accordions to group related content (e.g., FAQ) - Keep the content within each panel concise and scannable - Use Accordion instead of Tab if users need to see multiple sections at once **Don't** - Don't nest Accordions inside each other - Don't use Accordion to hide critical information needed for completing a task - Don't use vague or generic titles like "Section 1", they should be descriptive - Don't expose a lot of content in the title ### Best Practices in Context 1. **Accordion** 2. **Header** 3. **Panel** ## Placement The **Accordion** component is adjusted to the parent's width. It can vary based on the content, layout, and page design. By default, the **Accordion** content is left-aligned in its container, as the header does. It can be placed within main page content or inside a side container (as panels, or tiles). ## Behavior An **Accordion** can be hovered, focused, clicked and disabled. **Accordion** has two states : collapsed and expanded. It is collapsed by default. When triggering the header part, the panel part should react as expanding or collapsing, depending on what previous state it had. The mouse cursor acts as a clickable area on the Header part of the component. The **Icon** helps the user to know if the **Accordion** is collapsed or expanded : * Collapsed : chevron points right * Expanded : chevron points down The Header part of this component acts like a button, with hover, focus and active styles. With the `low` emphasis, hovering only changes the cursor, as there is no border or background to highlight. Same behavior and styling applies to both Desktop and Mobile modes. ## Variation ### Emphasis The emphasis sets the visual weight of the **Accordion**, not the importance of its content. It applies to all its items. - **High**: the panel of an open item sits on a muted surface that sets it apart from the header, with the `medium` borders. Use it when the **Accordion** must stand out from the surrounding content. - **Medium** _(default)_: items are outlined by borders, on the raised surface. - **Low**: no border nor background: spacing separates the items. Use it in a dense layout, or when the **Accordion** is already inside a framed container (a Card, a side panel). Every emphasis supports the disabled state, the multiple mode and both expand icon positions. The keyboard focus stays visible on the header in every emphasis. ```tsx