Skip to content

A set of expandable (collapsible) sections. Supports single or multiple open mode.

atlas-accordion

Examples

Basic

Sections are data. One section is open at a time unless multiple is set.

Controlled

Bind [(expanded)] to open sections from code and read toggles back. The sidebar of this site uses it to open the group of the current page.

Open: returns

Custom title and content

Set titleTemplate / contentTemplate on an item to render your own markup; title and content stay the text fallback. Templates get the item ( let-item , with your payload in item.data ) and its open state ( let-expanded="expanded" ), so one template can serve every section.

API

Generated from the library source, so it always matches the code.

AtlasAccordionComponent atlas-accordion

InputTypeDefaultDescription
items requiredAccordionItem[]— The sections, with their titles and content (or templates).
multiple booleanfalse Lets several sections stay open at once; otherwise opening one closes the others.
expanded two-waystring[][] Ids of the expanded sections (two-way: [(expanded)] ). Lets the host open the section that matches the current route, or restore state. With multiple off, at most one id stays in the list.
headingLevel 1 | 2 | 3 | 4 | 5 | 6 | null3 ARIA heading level that wraps each trigger (default 3). Use null when the accordion is not part of the document outline, for example inside a navigation menu.
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.
bordered booleanfalse When true, wraps the accordion in a themed surface container (border, radius, and elevation from the active theme). Defaults to false, so the accordion renders inline with no chrome unless opted in.

Types

AccordionItem

One accordion section. title / content are plain text; set titleTemplate / contentTemplate to render your own markup instead (the text is the fallback). Templates get the item and its open state as context, so one template can serve every section: html <ng-template #answer let-item let-expanded="expanded"> <p>{{ item.data.answer }}</p> </ng-template> ts private readonly answer = viewChild.required<TemplateRef<AccordionItemContext<Faq>>>('answer'); protected readonly items = computed(() => this.faqs.map((faq) => ({ id: faq.id, title: faq.question, data: faq, contentTemplate: this.answer() })), );

PropertyTypeDescription
id string Unique id of the section (used by [(expanded)] ); not rendered.
title string Heading text. Always set it: it is the fallback for titleTemplate .
content? string Plain text content.
titleTemplate? TemplateRef<AccordionItemContext<T>> Rendered in the header instead of title .
contentTemplate? TemplateRef<AccordionItemContext<T>> Rendered in the panel instead of content .
data? T Your own payload for the templates ( item.data ).

AccordionItemContext

Context of titleTemplate / contentTemplate : let-item and let-expanded="expanded" .

PropertyTypeDescription
$implicit AccordionItem<T> —
expanded boolean —