Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Basic

One pane open at a time is the default and the right choice for an FAQ, because it keeps the list scannable.

An FAQ list
Show code
<app-accordion>
    <app-accordion-item title="What does a risk assessment cover?">…</app-accordion-item>
    <app-accordion-item title="Can I revise a report after it is issued?">…</app-accordion-item>
    <app-accordion-item title="What formats can I export?">…</app-accordion-item>
</app-accordion>

More than one open

Set multiple when the panes are independent and a reader may want to compare two of them side by side.

Independent panes
Show code
<app-accordion multiple="true">
    <app-accordion-item title="What does a risk assessment cover?">…</app-accordion-item>
    <app-accordion-item title="Can I revise a report after it is issued?">…</app-accordion-item>
    <app-accordion-item title="What formats can I export?">…</app-accordion-item>
</app-accordion>

Starting expanded

Mark an item open to expand it on first render, when one pane is the common case and the rest are exceptions.

First pane open
Every zone on the site, scored against the current IEC 62305-2 methodology.
Show code
<app-accordion>
    <app-accordion-item title="What does a risk assessment cover?" open="true">…</app-accordion-item>
    <app-accordion-item title="Can I revise a report after it is issued?">…</app-accordion-item>
    <app-accordion-item title="What formats can I export?">…</app-accordion-item>
</app-accordion>
Keyless items, only the third open
Panes need no key. Without one, a pane is identified by its position.
3
Show code
<app-accordion>
    <app-accordion-item title="First">1</app-accordion-item>
    <app-accordion-item title="Second">2</app-accordion-item>
    <app-accordion-item title="Third" open="true">3</app-accordion-item>
</app-accordion>

Flat

Use flat for a section header inside a page: a text toggle with a leading chevron and an optional count.

Flat with counts
Show code
<app-accordion variant="Flat">
    <app-accordion-item title="Completed" count="3">…</app-accordion-item>
    <app-accordion-item title="Archived" count="0">…</app-accordion-item>
</app-accordion>

Heading with markup

Put markup in an app-accordion-heading child when the heading holds a grid, a badge or an icon. The title attribute stays plain text.

Heading with markup
A heading holds any markup, such as a grid of figures. The row stays a button, so the keyboard and screen-reader behaviour is the same as a text title.
Show code
<app-accordion>
    <app-accordion-item title="Sites">
        <app-accordion-heading><span data-wui-style="display:grid;grid-template-columns:1fr auto;gap:var(--wui-space-lg)"><strong>Sites</strong><span>12 scanned</span></span></app-accordion-heading>
        Each site and when it was last scanned.
    </app-accordion-item>
</app-accordion>

Every option

Every value of every prop, one cell each.

items

open not set (default): no pane open
(no app-accordion-item children): no panes
three panes, only the third open (Razor panes take no key)
3
open="true" on the first item
Every zone on the site, scored against the current IEC 62305-2 methodology.
open="true" on the first two items, multiple="false": only the first is honoured
Every zone on the site, scored against the current IEC 62305-2 methodology.
Yes. A revision supersedes the previous version and keeps the original in history.
count="2" with variant flat: a count chip after the title
content: long text, no max-height clip
It depends on the number of zones and the complexity of the roof and bonding network, but a typical single-building commercial site takes one working day for the site visit, plus report turnaround. Multi-building campuses or sites with restricted access windows can take several days of on-site work before the report is drafted, reviewed, and issued for sign-off.
rich markup in content: title stays plain text (no React-node equivalent)
Email support@example.com for help with any question above.

multiple

multiple="false" (default): mutually exclusive
Every zone on the site, scored against the current IEC 62305-2 methodology.
multiple="true": independent panes
Every zone on the site, scored against the current IEC 62305-2 methodology.
Yes. A revision supersedes the previous version and keeps the original in history.

variant

variant="bordered" (default): a card of questions
variant="flat": a text toggle with a leading chevron

openItems

open-items not set (default): each item's open decides
open-items="0": the first question opens
Every zone on the site, scored against the current IEC 62305-2 methodology.
open-items="0,2" with multiple="true": the first and third open
Every zone on the site, scored against the current IEC 62305-2 methodology.
PDF for sign-off and XLSX for the underlying zone data.

id

id not set (default): a unique id is generated
id="pricing-faq": a stable, deep-linkable prefix

closeLabel

close-label="Hide": each trigger carries it as data-close-label, for a stylesheet to show while open

className

class="demo-list": extra classes on the list

Guidance

What to do, and what to avoid.

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. → AppTabs
  • The content needs the user's full attention before they continue. → AppModal
  • Every pane will be read anyway, so collapsing just adds clicks. → plain sections with headings
  • It is a short helper text attached to a field label. → AppInfoTip

Titles that name what is inside

Do

Write the title as the question or the thing the reader is looking for. They are scanning titles, not content.

Avoid

"More information" says nothing about what is inside, so the reader has to open every pane to find what they want.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

bordered flat
React, generated from the controls
<AppAccordion
  items={items} // 3 pane(s)
/>
Razor, the same props
<app-accordion>
    <app-accordion-item title="What does a risk assessment cover?">…</app-accordion-item>
    <app-accordion-item title="Can I revise a report after it is issued?">…</app-accordion-item>
    <app-accordion-item title="What formats can I export?">…</app-accordion-item>
</app-accordion>

6 props. The 4 most used come first.

Used on most screens 4 props

PropTypeDefaultDescription
multipledefault false bool false Allows more than one pane open at a time. Leave it off for a list the reader scans.
open-itemsdefault - string - Comma-separated positions of the panes that start open, counted from 0 ("0,2"). Replaces each pane's own open; without multiple only the first position opens.
variantdefault bordered bordered | flat bordered bordered (default) | flat: a text toggle with a leading chevron and an optional count chip, for a section header rather than a card of questions.
close-labeldefault - string - The label every trigger carries as data-close-label, for a stylesheet to show while the pane is open.

Less common 2 props

PropTypeDefaultDescription
iddefault generated string generated Prefix for the generated pane ids. Set it when a pane needs a stable anchor to link to.
classdefault - string - Extra classes on the list root.

<app-accordion-item> takes title (the always-visible row, plain text, no rich-node equivalent) and open (start expanded), plus count (a count chip after the title; 0 shows 0); its inner markup is the revealed body and may contain HTML.

Screen reader

3 notes
  • Each title is a native button with aria-expanded and aria-controls pointing at its pane, so Enter and Space toggle it.
  • Each pane is a section labelled by its title button.
  • A closed pane stays in the page but is inert and hidden from assistive technology until it opens.

Do and avoid

1 pairs

Titles that name what is inside

Do

Write the title as the question or the thing the reader is looking for. They are scanning titles, not content.

Avoid

"More information" says nothing about what is inside, so the reader has to open every pane to find what they want.