Accordion
Data-driven or fully composable disclosure groups with controlled Signals state, deterministic ARIA relationships and complete visual ownership.
GET STARTED
Import
Use the concise canonical class names from the granular entry point. Import only the declarations your template uses.
Data-driven FAQ
Property mappings turn immutable object arrays into concise text panels. Disabled items remain visible and cannot be expanded.
Projected composition
Panel, header and content declarations accept arbitrary Angular content. Do not combine projected panels with a non-empty data array.
Multiple panels
In multiple mode the controlled value is an array and each enabled panel toggles independently.
Non-collapsible single mode
Set collapsible=false when one single-mode panel must always remain expanded. It has no effect in multiple mode.
Disabled group and panel
Disable the entire group or only one projected panel. Disabled headers use native button state and keyboard navigation skips them.
Disabled panel
Disabled group
Controlled model and semantic event
valueChange powers two-way binding. panelChange adds panel identity, expanded state, previous/next model and keyboard or pointer source.
Unstyled and typed slots
Unstyled mode preserves disclosure semantics, inert collapsed content, focus movement and structural hooks while Tailwind owns every visible class.
Resolution rules and intentional boundaries
Data content is escaped plain text. itemValue must resolve to a unique string or number; invalid values fall back to the stable render index and duplicate values produce a development warning.
Use either [items] or projected panels. When both are present, data items are authoritative and development mode reports the mixed source.
Local unstyled and application-wide provideNeuralNg({ unstyled: true }) preserve the same structural, keyboard and ARIA contract. Programmatic model writes update expansion without emitting the user-only panelChange.
Remote loading, errors and rich content belong inside projected panels. The Beta contract does not pretend to lazy-instantiate collapsed templates; a future lazy API will require an explicit lifecycle contract.
ACCESSIBILITY
Accessible disclosure groups
No custom role imitates a button; every header trigger is a real native button.
Semantics and relationships
Headers expose aria-expanded and aria-controls. Content regions use aria-labelledby; collapsed content is both aria-hidden and inert.
Keyboard
Enter and Space use native button activation. Arrow Down/Up wrap between enabled headers. Home and End focus the first and last enabled header.
Focus
Toggling content never steals focus. Disabled headers leave navigation and deterministic SSR-safe IDs preserve relationships through hydration.
Motion
Content and chevron transitions use component tokens and collapse to effectively immediate changes under prefers-reduced-motion.
PUBLIC CONTRACT
Accordion API
Accordion inputs
| Name | Type | Default | Purpose |
|---|---|---|---|
| items | readonly TItem[] | [] | Data-driven panel source. |
| itemLabel | string | 'label' | Header text property. |
| itemValue | string | 'value' | Unique string/number value property. |
| itemContent | string | 'content' | Plain-text body property. |
| itemDisabled | string | 'disabled' | Per-item disabled property. |
| value | NeuralAccordionModelValue | null | Controlled single or multiple model. |
| multiple | boolean | false | Allows several expanded panels. |
| collapsible | boolean | true | Allows the active single panel to close. |
| disabled | boolean | false | Disables the whole group. |
| accordionId | string | generated | Stable ARIA id prefix. |
| unstyled | boolean | false | Removes NeuralNg visual classes. |
| accordionClass | string | '' | Additive root class. |
| classes | NeuralAccordionClasses | {} | Typed visual slot classes. |
Outputs
valueChangeNeuralAccordionModelValueGenerated model output.
panelChangeNeuralAccordionPanelChangeUser-only expanded/collapsed event with source and previous state.
Panel API
| value | NeuralAccordionValue | required | Panel identity. |
| disabled | boolean | false | Disables one projected panel. |
| panelClass | string | '' | Additive projected panel class. |
Header and content API
NeuralAccordionHeader.headerClassstring · ''NeuralAccordionHeader.triggerClassstring · ''NeuralAccordionContent.contentClassstring · ''Typed class slots
rootpanelexpandedPaneldisabledPanelheadertriggerlabeliconcontentcontentInnerDESIGN TOKENS
Accordion tokens
Neutral tokens respond to the selected primary palette, surface palette and resolved light/dark mode without changing the component contract.
--neural-accordion-gapSpacing between component items.
--neural-accordion-colorComponent foreground color.
--neural-accordion-font-familyComponent font family.
--neural-accordion-panel-backgroundPanel background surface.
--neural-accordion-panel-background-expandedExpanded panel background surface.
--neural-accordion-panel-borderPanel border shorthand.
--neural-accordion-panel-border-color-expandedExpanded panel border color.
--neural-accordion-panel-radiusPanel corner radius.
--neural-accordion-panel-shadowPanel box shadow.
--neural-accordion-panel-shadow-expandedExpanded panel box shadow.
--neural-accordion-panel-transitionPanel CSS transition.
--neural-accordion-trigger-paddingTrigger internal spacing.
--neural-accordion-trigger-gapSpacing between trigger items.
--neural-accordion-trigger-colorTrigger foreground color.
--neural-accordion-trigger-color-hoverHovered trigger foreground color.
--neural-accordion-trigger-color-expandedExpanded trigger foreground color.
--neural-accordion-trigger-backgroundTrigger background surface.
--neural-accordion-trigger-background-hoverHovered trigger background surface.
--neural-accordion-trigger-background-expandedExpanded trigger background surface.
--neural-accordion-trigger-font-sizeTrigger font size.
--neural-accordion-trigger-font-weightTrigger font weight.
--neural-accordion-trigger-line-heightTrigger line height.
--neural-accordion-trigger-transitionTrigger CSS transition.
--neural-accordion-content-paddingContent internal spacing.
--neural-accordion-content-colorContent foreground color.
--neural-accordion-content-font-sizeContent font size.
--neural-accordion-content-line-heightContent line height.
--neural-accordion-content-durationContent animation duration.
--neural-accordion-content-easingContent animation easing curve.
--neural-accordion-icon-sizeIcon width and height.
--neural-accordion-icon-colorIcon foreground color.
--neural-accordion-icon-color-expandedExpanded icon foreground color.
--neural-accordion-icon-durationIcon animation duration.
--neural-accordion-icon-easingIcon animation easing curve.
--neural-accordion-focus-ringComponent keyboard focus ring.
--neural-accordion-focus-ring-offsetComponent focus ring offset.
--neural-accordion-disabled-opacityDisabled opacity.