AppAccordion
Collapsible panes — an FAQ list, grouped settings, a “more detail” disclosure.
<app-accordion><app-accordion-item title="…">…</app-accordion-item></app-accordion><app-accordion> hides detail until it is asked for. Reach for it when a page has several self-contained blocks a reader will want one of — an FAQ list, grouped settings, per-section notes on a long form.
Height animates through grid-template-rows: 0fr → 1fr, so a pane opens to its natural height with no measuring and no max-height guess that clips long content. The React <AppAccordion> renders the identical markup.
Playground
Every attribute, live. Each change re-renders the real tag helper on the server, so the markup underneath is the exact call that produced the panes above it.
open="true" while multiple is off and only the first is honoured — the panes are mutually exclusive on first render, same as after a click.Basic
One pane open at a time — opening a second closes the first. This is the default, and the right one for an FAQ: it keeps the list scannable.
Show code
<app-accordion>
<app-accordion-item title="What does a risk assessment cover?">Every zone on the site…</app-accordion-item>
<app-accordion-item title="Can I revise a report after it is issued?">Yes — a revision…</app-accordion-item>
</app-accordion>
0fr. That is what makes the open transition smooth, and it means in-page search (Ctrl+F) finds text inside a closed pane. Don't put a heavy component inside dozens of panes expecting it to be unmounted.More than one open
Set multiple when the panes are independent and a reader may want to compare two of them side by side — grouped settings rather than a list of questions.
Show code
<app-accordion multiple="true">…</app-accordion>
Starting expanded
Mark an item open to have it expanded on first render — useful when one pane is the common case and the rest are exceptions.
multiple off, only the first open item expands.Show code
<app-accordion-item title="…" open="true">…</app-accordion-item>
When to use
Use it when
- A page has several self-contained blocks and a reader wants one of them.
- The content is secondary — reference detail, an FAQ answer, an advanced setting.
- Collapsing keeps a long page scannable rather than hiding something essential.
Reach for something else when
- The sections are alternative views of the same thing. → app-tabs
- The content needs full attention before continuing. → app-modal
- Every pane will be read anyway — collapsing just adds clicks. → plain sections
- It is one short hint on a field label. → app-info-tip
Best practices
Every option
The whole surface of the component, one cell per value — including the branch a normal example never shows: an empty list, keyless items, and rich content.
multiple
multiple="false" — default, mutually exclusive
multiple="true" — independent panes
open (initial state)
(no item open)
open="true" on the first item
two items open, multiple="false" — only the first is honoured
three items, only the third open
id
(no id) — a unique id is generated
id="pricing-faq" — a stable, deep-linkable prefix
content
long content — no max-height clip
rich markup in content — title stays plain text (no React-node equivalent)
empty
(no app-accordion-item children)
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
| multiple | bool | false | Allow more than one pane open at a time. |
| id | string | generated | Prefix for the pane ids. Set it when a pane needs a stable anchor to deep-link to. |
| class | string | — | Extra classes on the list root; matches React's className. |
<app-accordion-item> takes title (the always-visible row, plain text — no rich-node equivalent) and open (start expanded); its inner markup is the revealed body and may contain HTML.