ARIA Accordion
The ARIA Accordion provides an accessible, expandable/collapsible content panel system following WAI-ARIA patterns.Installation
Components
AccordionGroup
A container for a group of accordion items that manages overall state and interactions. Selector:[ngAccordionGroup]
Source: /home/daytona/workspace/source/src/aria/accordion/accordion-group.ts:72
Inputs
multiExpandable(boolean) - Whether multiple accordion items can be expanded simultaneously. Default:truedisabled(boolean) - Whether the entire accordion group is disabled. Default:falsesoftDisabled(boolean) - Whether disabled items can receive focus. Whentrue, disabled items are focusable but not interactive. Default:truewrap(boolean) - Whether keyboard navigation wraps from last to first item. Default:false
Methods
expandAll()- Expands all accordion panels (if multi-expandable)collapseAll()- Collapses all accordion panels
AccordionPanel
The content panel that is conditionally visible based on trigger state. Selector:[ngAccordionPanel]
Source: /home/daytona/workspace/source/src/aria/accordion/accordion-panel.ts:42
Inputs
panelId(string, required) - A local unique identifier that matches the corresponding trigger’spanelIdid(string) - A global unique identifier for the panel. Auto-generated if not providedpreserveContent(boolean) - Whether to preserve content when collapsed
Properties
visible(signal) - Whether the accordion panel is visible
Methods
expand()- Expands this panelcollapse()- Collapses this paneltoggle()- Toggles the expansion state
AccordionTrigger
Button element that toggles panel visibility. Selector:[ngAccordionTrigger]
Inputs
panelId(string, required) - Identifier matching the corresponding panel’spanelIddisabled(boolean) - Whether this trigger is disabled
AccordionContent
Directive for lazy-loaded accordion content. Selector:[ngAccordionContent]
Basic Usage
Single Expansion Mode
Keyboard Navigation
- Arrow Keys - Navigate between accordion triggers
- Enter/Space - Toggle the focused accordion panel
- Home - Focus first accordion trigger
- End - Focus last accordion trigger
Accessibility Features
- Implements ARIA accordion pattern
- Proper roles:
buttonfor triggers,regionfor panels aria-expandedstate managementaria-controlsandaria-labelledbyassociationsinertattribute for hidden content- Full keyboard navigation support
- Screen reader announcements