Provide items with a stable unique id, title and optional sanitized HTML content. multiple permits several open panels. Bind expandedKeys and accept expandedKeysChange for application-owned state, or omit expandedKeys and use initialExpandedKeys once. Keep that choice for the lifetime of the instance. Header and body Templates receive the item and expanded state.
These values match the current preview. Complete handlers, Core imports and templates are in Source.
configured-state.ts
import { signal } from '@angular/core';
export const items = signal([
{
"id": "delivery",
"title": "Delivery",
"content": "Orders arrive within two working days."
},
{
"id": "returns",
"title": "Returns",
"content": "Contact support within 30 days."
},
{
"id": "unavailable",
"title": "Coming soon",
"disabled": true
}
]);
export const expanded = signal([
"delivery"
]);
These inputs require a model or function, not a checkbox. Edit the same-named field in the Source component and bind it in the template; data already used by this preview appears in the state above.
initialExpandedKeys ยท readonly K[]
In Source: define initialExpandedKeys with this type and use [initialExpandedKeys]="initialExpandedKeys" (or initialExpandedKeys() for a signal).
expandedKeysChange proposes the complete open-key array. panelToggle reports the individual user action as { id, expanded }. initialExpandedKeys is not a reactive replacement for applied state.
Tab reaches enabled headers. Enter or Space opens or closes a section. Arrow Up/Down, Home and End move header focus, skipping disabled items. Closed content is inert. Keep custom headers free of nested interactive controls.
Key
Action
Tab
Reach enabled headers and controls inside open sections.
Inputs and Outputs match the pinned Core package. Named types link to their definitions. Templates include executable examples for each supported region.
Inputs
Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.
Name
Type
Default
Template binding
Description
bordered
boolean
true
[bordered]
Draw the outside border.
expandedKeys
readonly K[] | undefined
undefined
[expandedKeys]
Applied open keys; undefined selects uncontrolled mode once.
initialExpandedKeys
readonly K[]
[]
[initialExpandedKeys]
One-time open-key seed when expandedKeys is omitted.
items
readonly T[]
[]
[items]
Items with stable unique id, title, optional HTML content and disabled flag.
multiple
boolean
false
[multiple]
Allow more than one open panel.
Outputs
Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.
ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.
Use let-item and let-expanded="expanded". The header is already a button; place actions inside the body.
ng-template[neuAccordionBody]
Context used: $implicit: item, expanded: boolean
template.d.ts
import type { NeuAccordionItem } from '@neural-ui/core/accordion';
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
import { NeuAccordionBodyDirective } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export declare class NeuAccordionBodyDirective<T extends NeuAccordionItem<NeuAccordionKey> = NeuAccordionItem<NeuAccordionKey>> {
}
context.d.ts
import type { NeuAccordionBodyContext } from '@neural-ui/core/accordion';
import { NeuAccordionBodyDirective } from '@neural-ui/core/accordion';
// Public declaration (reference only)
readonly templateRef: TemplateRef<NeuAccordionBodyContext<T>>;
Use let-item and let-expanded="expanded". The header is already a button; place actions inside the body.
ng-template[neuAccordionHeader]
Context used: $implicit: item, expanded: boolean
template.d.ts
import type { NeuAccordionItem } from '@neural-ui/core/accordion';
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
import { NeuAccordionHeaderDirective } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export declare class NeuAccordionHeaderDirective<T extends NeuAccordionItem<NeuAccordionKey> = NeuAccordionItem<NeuAccordionKey>> {
}
context.d.ts
import type { NeuAccordionHeaderContext } from '@neural-ui/core/accordion';
import { NeuAccordionHeaderDirective } from '@neural-ui/core/accordion';
// Public declaration (reference only)
readonly templateRef: TemplateRef<NeuAccordionHeaderContext<T>>;
Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.
Header
NeuAccordionHeaderDirective
Header
Orders arrive within two working days.
Contact support within 30 days.
Body
NeuAccordionBodyDirective
Body
Orders arrive within two working days.
Requests: 0
Contact support within 30 days.
Requests: 0
Requests: 0
Public Types
Open a type to inspect its definition and interface fields.
NeuAccordionBodyContext.d.ts
import type { NeuAccordionItem } from '@neural-ui/core/accordion';
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
import type { NeuAccordionBodyContext } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export interface NeuAccordionBodyContext<T extends NeuAccordionItem<NeuAccordionKey> = NeuAccordionItem<NeuAccordionKey>> {
readonly $implicit: T;
readonly expanded: boolean;
}
NeuAccordionHeaderContext.d.ts
import type { NeuAccordionItem } from '@neural-ui/core/accordion';
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
import type { NeuAccordionHeaderContext } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export interface NeuAccordionHeaderContext<T extends NeuAccordionItem<NeuAccordionKey> = NeuAccordionItem<NeuAccordionKey>> {
readonly $implicit: T;
readonly expanded: boolean;
}
NeuAccordionItem.d.ts
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
import type { NeuAccordionItem } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export interface NeuAccordionItem<K extends NeuAccordionKey = string> {
readonly content?: string;
readonly disabled?: boolean;
readonly id: K;
readonly title: string;
}
NeuAccordionKey.d.ts
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export type NeuAccordionKey = string | number;
NeuAccordionPanelToggle.d.ts
import type { NeuAccordionKey } from '@neural-ui/core/accordion';
import type { NeuAccordionPanelToggle } from '@neural-ui/core/accordion';
// Public declaration (reference only)
export interface NeuAccordionPanelToggle<K extends NeuAccordionKey = string> {
readonly expanded: boolean;
readonly id: K;
}