Accordion overview
Headless accordion gives you section registration, roving trigger focus, and panel visibility semantics without prescribing markup beyond the root, item, trigger, and panel directives.
Primitive imports
ts
import {
TngAccordion,
TngAccordionItem,
TngAccordionTrigger,
TngAccordionPanel,
} from '@tailng-ui/primitives';
Basic composition
Attach tngAccordion to a group root, register each section with tngAccordionItem, and let the trigger and panel coordinate ids and ARIA wiring.
Headless accordion composition
html
<section tngAccordion aria-label="Workspace FAQ" [defaultValue]="'ownership'">
<article tngAccordionItem value="ownership">
<button tngAccordionTrigger type="button">Ownership model</button>
<div tngAccordionPanel>
Copy-paste mode keeps wrapper source in your app for long-term ownership.
</div>
</article>
<article tngAccordionItem value="testing">
<button tngAccordionTrigger type="button">Testing strategy</button>
<div tngAccordionPanel>
Primitive suites cover keyboard, pointer, and ARIA behavior.
</div>
</article>
</section>
Style variants
The same headless primitive contract rendered through a local CSS shell or a Tailwind utility shell.
Headless accordion (plain CSS)
Copy-paste mode keeps source in your app for long-term ownership.
Primitive suites validate keyboard, pointer, and aria behavior.
Headless accordion (Tailwind CSS)
Define release policy, reviewer gates, and rollback ownership.
Ship documentation and examples in the same milestone cadence.
Accessibility baseline
- Triggers reflect
aria-expanded,aria-controls, and rovingtabindex. - Panels render as
role="region"and point back to the owning trigger witharia-labelledby. - Arrow Up, Arrow Down, Home, and End move across enabled triggers.
- Use native
buttontriggers when possible so tab order stays natural.