Skip to content

Anatomy

Accordion is a compound component: a root orchestrates one or more AccordionItem children, each wiring its parts through data-ref attributes. Use this map to see which parts exist and how they nest.

Structure

Accordion                                data-component="Accordion"
└─ AccordionItem  (× n)                  data-component="AccordionItem"
   ├─ button      [data-ref="btn"]       the toggle, controls the panel
   └─ container   [data-ref="container"] the collapsible wrapper
      └─ content  [data-ref="content"]   the panel content

Parts

PartSelectorRequiredRole
Rootdata-component="Accordion"YesGroups the items, handles autoclose, forwards the shared item options.
Itemdata-component="AccordionItem"Yes (× n)A single expandable section. Holds the isOpen and styles options.
Triggerdata-ref="btn"YesThe <button> that toggles its item. aria-controls / aria-expanded are set automatically.
Containerdata-ref="container"YesThe animated wrapper whose height transitions between open and closed.
Contentdata-ref="content"YesThe revealed content. aria-hidden / aria-labelledby are set automatically.

The Accordion.twig template renders this structure for you from an items array. See the Twig API for parameters and blocks.