The Accordion component has been refactored to use React Context for internal state management. As part of this refactor:
alignis no longer accepted onAccordionItemorAccordionHeader. Alignment is now a single top‑level concern configured only on the parentAccordioncomponent and provided to its descendants via React Context.AccordionItemandAccordionHeadermust now be used inside anAccordionwrapper — they can no longer be used as standalone components.
Note: In v5, any
alignvalue you passed toAccordionItemorAccordionHeaderwas already ignored because the effective alignment always came from the parentAccordion(defaulting toend). The v6 removal simply formalizes this behavior and eliminates a misleading prop surface.
| Component | v5.x | v6.x |
|---|---|---|
| Accordion | align prop ("start" | "end") |
no change |
| AccordionItem | align overwritten from Accordion |
removed |
| AccordionHeader | align overwritten from Accordion |
removed |
Previously, allowing align on each item/header introduced prop duplication, and increased rendering complexity. The property was always overwritten by the parent Accordion and therefore led to wrong expectations of the chevron positioning. Centralizing the setting:
- Reduces prop surface area and cognitive load.
- Simplifies implementation by making use of react context instead of prop-drilling.
- Enforces proper component hierarchy —
AccordionItemandAccordionHeadernow require the context provided byAccordion.
- Remove all
alignprops fromAccordionItemandAccordionHeaderusages. - Add a single
alignprop to the parent<Accordion>if you relied on non‑default alignment. - Ensure that all
AccordionItem/AccordionHeaderinstances are direct or nested descendants of theAccordion(they must be inside the provider for the context value to resolve).
<Accordion>
<AccordionItem align="start" title="A" />
<AccordionItem align="end" title="B" />
<AccordionItem title="C">
<AccordionHeader align="start">Custom Header</AccordionHeader>
</AccordionItem>
</Accordion>;
{
/* Standalone usage (no longer supported) */
}
<AccordionItem title="Standalone" />;<Accordion align="start">
<AccordionItem title="A" />
<AccordionItem title="B" />
<AccordionItem title="C">
<AccordionHeader>Custom Header</AccordionHeader>
</AccordionItem>
</Accordion>;
{
/* Standalone usage now requires wrapper */
}
<Accordion>
<AccordionItem title="Standalone" />
</Accordion>;If you previously mixed different alignments per item, choose a single value that best matches the dominant layout (typically end, which remains the default). The new API intentionally does not support heterogeneous alignment inside one Accordion.
<Accordion align="start" | "end" /> // default is "end"All other Accordion props remain unchanged.
- No remaining
alignusage onAccordionItem/AccordionHeader. - Parent
<Accordion>includesalignonly if deviating from default. - All accordion structural children are nested within
<Accordion>.
Q: I need different alignment for a single item.
A: Wrap that item in a separate Accordion instance if absolutely necessary, or redesign to use a consistent alignment. Mixed chevron alignment in a single list is now considered a design anti‑pattern.
Q: What happens if I leave old align props in place?
A: They will be ignored (and in strict TypeScript settings, produce a type error). Remove them to prevent confusion.
Q: What happens if I use AccordionItem outside of Accordion?
A: You will get a runtime error because the component requires the React Context provided by Accordion. Always wrap AccordionItem and AccordionHeader in an Accordion component.
Q: Can I still use AccordionItem independently?
A: No. In v6, AccordionItem relies on context from Accordion. If you need a single item, wrap it in <Accordion>. If you only need the behaviour of an opening / closing component use the <Collapse> component