Anatomy
The aegov-accordion component composes a wrapper with one or more aegov-accordion-item children. The parent owns shared configuration — icon style, heading size, single-open vs. multi-open behaviour, and first/last positioning — and propagates it to each item automatically.

| Item | Name | Description |
|---|---|---|
1 |
Trigger | A real <button> wrapped in a heading element; toggles the item open or closed |
2 |
Heading label | The slotted or heading-property text announced by the trigger |
3 |
Toggle icon | Chevron or plus/cross indicator that reflects open state |
4 |
Content panel | The collapsible region shown when the item is open |
Options
The accordion has options for different use cases. These are considered the basic properties applicable to an accordion.
Single (default)
Multiple
Single vs. multiple open
By default the accordion behaves like a radio group — opening one item collapses the rest. Set is-multiple="true" to allow any number of items to be expanded at once.
Chevron (default)
Plus / cross
Toggle icon
The icon property selects the visual indicator next to each heading. chevron (default) rotates 180° as the item expands. plus rotates 45° to form a cross (×) when open.
Default
is-bordered="true"
Bordered container
Set is-bordered="true" to wrap the entire accordion in a rounded outline. Use this when the accordion sits on a page background that needs a visible boundary; omit it when the surrounding card already provides one.
Default open item
Use default-open with a zero-based index to expand a specific item on initial render. This is useful for highlighting the most important question in an FAQ.
<aegov-accordion default-open="1">
<aegov-accordion-item heading="Section A">First section content.</aegov-accordion-item>
<aegov-accordion-item heading="Section B (open by default)">Second section content — open on initial render.</aegov-accordion-item>
<aegov-accordion-item heading="Section C">Third section content.</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function DefaultOpenAccordion() {
return (
<AegovAccordion defaultOpen={1}>
<AegovAccordionItem heading="Section A">First section content.</AegovAccordionItem>
<AegovAccordionItem heading="Section B (open by default)">Second section content — open on initial render.</AegovAccordionItem>
<AegovAccordionItem heading="Section C">Third section content.</AegovAccordionItem>
</AegovAccordion>
);
}
<template>
<aegov-accordion default-open="1">
<aegov-accordion-item heading="Section A">First section content.</aegov-accordion-item>
<aegov-accordion-item heading="Section B (open by default)">Second section content — open on initial render.</aegov-accordion-item>
<aegov-accordion-item heading="Section C">Third section content.</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-default-open-accordion',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<aegov-accordion [defaultOpen]="1">
<aegov-accordion-item heading="Section A">First section content.</aegov-accordion-item>
<aegov-accordion-item heading="Section B (open by default)">Second section content — open on initial render.</aegov-accordion-item>
<aegov-accordion-item heading="Section C">Third section content.</aegov-accordion-item>
</aegov-accordion>
`,
})
export class DefaultOpenAccordionComponent {}
Size
The size property sets the heading typography. Three tokens are available: sm, base (default), and lg. The body content keeps its inherited size, and the trigger's heading text and toggle icon scale together: 20px icon at sm, 24px (default) at base, 26px at lg.
| Token | Heading size |
|---|---|
sm |
14px |
base |
16px (default) |
lg |
18px |
Size is a responsive property and can accept a token per breakpoint.
<aegov-accordion size="sm">
<aegov-accordion-item heading="Small heading">Compact size suits dense administrative interfaces.</aegov-accordion-item>
</aegov-accordion>
<aegov-accordion size="base">
<aegov-accordion-item heading="Base heading">The default size, suitable for most page contexts.</aegov-accordion-item>
</aegov-accordion>
<aegov-accordion size="lg">
<aegov-accordion-item heading="Large heading">Large size works well as a primary FAQ on a landing page.</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function AccordionSizes() {
return (
<>
<AegovAccordion size="sm">
<AegovAccordionItem heading="Small heading">Compact size suits dense administrative interfaces.</AegovAccordionItem>
</AegovAccordion>
<AegovAccordion size="base">
<AegovAccordionItem heading="Base heading">The default size, suitable for most page contexts.</AegovAccordionItem>
</AegovAccordion>
<AegovAccordion size="lg">
<AegovAccordionItem heading="Large heading">Large size works well as a primary FAQ on a landing page.</AegovAccordionItem>
</AegovAccordion>
</>
);
}
<template>
<aegov-accordion size="sm">
<aegov-accordion-item heading="Small heading">Compact size suits dense administrative interfaces.</aegov-accordion-item>
</aegov-accordion>
<aegov-accordion size="base">
<aegov-accordion-item heading="Base heading">The default size, suitable for most page contexts.</aegov-accordion-item>
</aegov-accordion>
<aegov-accordion size="lg">
<aegov-accordion-item heading="Large heading">Large size works well as a primary FAQ on a landing page.</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-accordion-sizes',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<aegov-accordion size="sm">
<aegov-accordion-item heading="Small heading">Compact size suits dense administrative interfaces.</aegov-accordion-item>
</aegov-accordion>
<aegov-accordion size="base">
<aegov-accordion-item heading="Base heading">The default size, suitable for most page contexts.</aegov-accordion-item>
</aegov-accordion>
<aegov-accordion size="lg">
<aegov-accordion-item heading="Large heading">Large size works well as a primary FAQ on a landing page.</aegov-accordion-item>
</aegov-accordion>
`,
})
export class AccordionSizesComponent {}
Responsive size
size can also be set per breakpoint using a responsive string. Only the three tokens above — sm, base, lg — are valid values at any breakpoint. Pick a value to preview what it resolves to.
<aegov-accordion size="sm md:base xl:lg">
<aegov-accordion-item heading="Resizes with the viewport">
Resize your browser to see the heading scale across the sm, md, and xl breakpoints.
</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function ResponsiveAccordion() {
return (
<AegovAccordion size="sm md:base xl:lg">
<AegovAccordionItem heading="Resizes with the viewport">
Resize your browser to see the heading scale across the sm, md, and xl breakpoints.
</AegovAccordionItem>
</AegovAccordion>
);
}
<template>
<aegov-accordion size="sm md:base xl:lg">
<aegov-accordion-item heading="Resizes with the viewport">
Resize your browser to see the heading scale across the sm, md, and xl breakpoints.
</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-responsive-accordion',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<aegov-accordion size="sm md:base xl:lg">
<aegov-accordion-item heading="Resizes with the viewport">
Resize your browser to see the heading scale across the sm, md, and xl breakpoints.
</aegov-accordion-item>
</aegov-accordion>
`,
})
export class ResponsiveAccordionComponent {}
Heading level
The heading-level property controls which HTML heading element (h1–h6) wraps each trigger button. Setting the correct level keeps the page outline meaningful for screen readers. The default is 3; use a lower number when the accordion is the primary content structure on a page, or a higher number when it sits inside an existing heading hierarchy.
heading-level="2"
heading-level="3" (default)
<!-- Triggers render inside <h2> elements -->
<aegov-accordion heading-level="2">
<aegov-accordion-item heading="Trade licence application">
Submit your application through the business licensing portal.
</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function HeadingLevelAccordion() {
return (
<AegovAccordion headingLevel={2}>
<AegovAccordionItem heading="Trade licence application">
Submit your application through the business licensing portal.
</AegovAccordionItem>
</AegovAccordion>
);
}
<template>
<aegov-accordion heading-level="2">
<aegov-accordion-item heading="Trade licence application">
Submit your application through the business licensing portal.
</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-heading-level-accordion',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<aegov-accordion [headingLevel]="2">
<aegov-accordion-item heading="Trade licence application">
Submit your application through the business licensing portal.
</aegov-accordion-item>
</aegov-accordion>
`,
})
export class HeadingLevelAccordionComponent {}
Custom heading slot
When the trigger needs richer markup — formatting, an inline icon, a status badge — use the accordion-item-heading slot instead of the heading property. The slot replaces the plain text heading entirely.
<aegov-accordion>
<aegov-accordion-item>
<span slot="accordion-item-heading">
<strong>Step 1.</strong> Verify your identity
<aegov-badge variant="aegreen" size="sm">Required</aegov-badge>
</span>
Use your Emirates ID to confirm your identity before proceeding.
</aegov-accordion-item>
<aegov-accordion-item>
<span slot="accordion-item-heading">
<strong>Step 2.</strong> Submit your documents
</span>
Upload the supporting documents listed in the application form.
</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem, AegovBadge } from '@aegov/designsystem-react';
export default function CustomHeadingAccordion() {
return (
<AegovAccordion>
<AegovAccordionItem>
<span slot="accordion-item-heading">
<strong>Step 1.</strong> Verify your identity
<AegovBadge variant="aegreen" size="sm">Required</AegovBadge>
</span>
Use your Emirates ID to confirm your identity before proceeding.
</AegovAccordionItem>
<AegovAccordionItem>
<span slot="accordion-item-heading">
<strong>Step 2.</strong> Submit your documents
</span>
Upload the supporting documents listed in the application form.
</AegovAccordionItem>
</AegovAccordion>
);
}
<template>
<aegov-accordion>
<aegov-accordion-item>
<span slot="accordion-item-heading">
<strong>Step 1.</strong> Verify your identity
<aegov-badge variant="aegreen" size="sm">Required</aegov-badge>
</span>
Use your Emirates ID to confirm your identity before proceeding.
</aegov-accordion-item>
<aegov-accordion-item>
<span slot="accordion-item-heading">
<strong>Step 2.</strong> Submit your documents
</span>
Upload the supporting documents listed in the application form.
</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem, AegovBadge } from '@aegov/designsystem-angular';
@Component({
selector: 'app-custom-heading-accordion',
imports: [AegovAccordion, AegovAccordionItem, AegovBadge],
template: `
<aegov-accordion>
<aegov-accordion-item>
<span slot="accordion-item-heading">
<strong>Step 1.</strong> Verify your identity
<aegov-badge variant="aegreen" size="sm">Required</aegov-badge>
</span>
Use your Emirates ID to confirm your identity before proceeding.
</aegov-accordion-item>
<aegov-accordion-item>
<span slot="accordion-item-heading">
<strong>Step 2.</strong> Submit your documents
</span>
Upload the supporting documents listed in the application form.
</aegov-accordion-item>
</aegov-accordion>
`,
})
export class CustomHeadingAccordionComponent {}
Disabled items
Set is-disabled="true" on an individual item to prevent it from being opened. The trigger renders as visually muted and remains focusable, but is marked with aria-disabled="true" to communicate its disabled state to assistive technology.
<aegov-accordion>
<aegov-accordion-item heading="Active service">This service is currently accepting applications.</aegov-accordion-item>
<aegov-accordion-item heading="Coming soon" is-disabled="true">This section is not yet available.</aegov-accordion-item>
<aegov-accordion-item heading="Active service">This service is currently accepting applications.</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function DisabledAccordionItem() {
return (
<AegovAccordion>
<AegovAccordionItem heading="Active service">This service is currently accepting applications.</AegovAccordionItem>
<AegovAccordionItem heading="Coming soon" isDisabled>This section is not yet available.</AegovAccordionItem>
<AegovAccordionItem heading="Active service">This service is currently accepting applications.</AegovAccordionItem>
</AegovAccordion>
);
}
<template>
<aegov-accordion>
<aegov-accordion-item heading="Active service">This service is currently accepting applications.</aegov-accordion-item>
<aegov-accordion-item heading="Coming soon" is-disabled="true">This section is not yet available.</aegov-accordion-item>
<aegov-accordion-item heading="Active service">This service is currently accepting applications.</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-disabled-accordion-item',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<aegov-accordion>
<aegov-accordion-item heading="Active service">This service is currently accepting applications.</aegov-accordion-item>
<aegov-accordion-item heading="Coming soon" [isDisabled]="true">This section is not yet available.</aegov-accordion-item>
<aegov-accordion-item heading="Active service">This service is currently accepting applications.</aegov-accordion-item>
</aegov-accordion>
`,
})
export class DisabledAccordionItemComponent {}
Rich text content
The default slot of aegov-accordion-item accepts any HTML — lists, paragraphs, tables, or nested components. The content panel expands to fit whatever is placed inside it.
Submit the following when applying for a trade licence:
- Completed application form
- Emirates ID (both sides)
- Passport copy
- Proof of business address
Nested accordion
A nested accordion places a single aegov-accordion element inside the item of a parent accordion. heading-level auto-increments by one for the nested accordion unless it is set explicitly, keeping the document outline correct without extra configuration.
To receive a passport, you must follow the steps mentioned here
<aegov-accordion is-bordered="true">
<aegov-accordion-item heading="How can I get a passport">
<p>To receive a passport, you must follow the steps mentioned here</p>
<aegov-accordion icon="plus">
<aegov-accordion-item heading="Privacy policy">We collect only the data necessary to provide the service.</aegov-accordion-item>
<aegov-accordion-item heading="Terms of service">By using this service you agree to the terms set out in the official agreement.</aegov-accordion-item>
</aegov-accordion>
</aegov-accordion-item>
<aegov-accordion-item heading="Documents required">Second item content.</aegov-accordion-item>
<aegov-accordion-item heading="Appointment booking">Third item content.</aegov-accordion-item>
</aegov-accordion>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function NestedAccordion() {
return (
<AegovAccordion isBordered>
<AegovAccordionItem heading="How can I get a passport">
<p>To receive a passport, you must follow the steps mentioned here</p>
<AegovAccordion icon="plus">
<AegovAccordionItem heading="Privacy policy">We collect only the data necessary to provide the service.</AegovAccordionItem>
<AegovAccordionItem heading="Terms of service">By using this service you agree to the terms set out in the official agreement.</AegovAccordionItem>
</AegovAccordion>
</AegovAccordionItem>
<AegovAccordionItem heading="Documents required">Second item content.</AegovAccordionItem>
<AegovAccordionItem heading="Appointment booking">Third item content.</AegovAccordionItem>
</AegovAccordion>
);
}
<template>
<aegov-accordion is-bordered="true">
<aegov-accordion-item heading="How can I get a passport">
<p>To receive a passport, you must follow the steps mentioned here</p>
<aegov-accordion icon="plus">
<aegov-accordion-item heading="Privacy policy">We collect only the data necessary to provide the service.</aegov-accordion-item>
<aegov-accordion-item heading="Terms of service">By using this service you agree to the terms set out in the official agreement.</aegov-accordion-item>
</aegov-accordion>
</aegov-accordion-item>
<aegov-accordion-item heading="Documents required">Second item content.</aegov-accordion-item>
<aegov-accordion-item heading="Appointment booking">Third item content.</aegov-accordion-item>
</aegov-accordion>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-nested-accordion',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<aegov-accordion [isBordered]="true">
<aegov-accordion-item heading="How can I get a passport">
<p>To receive a passport, you must follow the steps mentioned here</p>
<aegov-accordion icon="plus">
<aegov-accordion-item heading="Privacy policy">We collect only the data necessary to provide the service.</aegov-accordion-item>
<aegov-accordion-item heading="Terms of service">By using this service you agree to the terms set out in the official agreement.</aegov-accordion-item>
</aegov-accordion>
</aegov-accordion-item>
<aegov-accordion-item heading="Documents required">Second item content.</aegov-accordion-item>
<aegov-accordion-item heading="Appointment booking">Third item content.</aegov-accordion-item>
</aegov-accordion>
`,
})
export class NestedAccordionComponent {}
RTL support
The accordion is direction-agnostic. When the document or any ancestor has dir="rtl", the trigger's flex-row layout reverses automatically — placing the toggle icon on the visual left — and a dedicated [dir="rtl"] rule right-aligns the heading text. No additional configuration is required.
<div dir="rtl">
<aegov-accordion is-bordered="true" default-open="0">
<aegov-accordion-item heading="ما هو نظام التصميم الإماراتي؟">
مكتبة مشتركة من مكوّنات واجهة المستخدم مبنية وفق معيار بصري وإمكانية وصول موحّدة.
</aegov-accordion-item>
<aegov-accordion-item heading="كيف يمكنني الإبلاغ عن خطأ؟">
افتح طلب دعم على مستودع المشروع، أو تواصل مع فريق نظام التصميم.
</aegov-accordion-item>
</aegov-accordion>
</div>
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-react';
export default function RtlAccordion() {
return (
<div dir="rtl">
<AegovAccordion isBordered defaultOpen={0}>
<AegovAccordionItem heading="ما هو نظام التصميم الإماراتي؟">
مكتبة مشتركة من مكوّنات واجهة المستخدم مبنية وفق معيار بصري وإمكانية وصول موحّدة.
</AegovAccordionItem>
<AegovAccordionItem heading="كيف يمكنني الإبلاغ عن خطأ؟">
افتح طلب دعم على مستودع المشروع، أو تواصل مع فريق نظام التصميم.
</AegovAccordionItem>
</AegovAccordion>
</div>
);
}
<template>
<div dir="rtl">
<aegov-accordion is-bordered="true" default-open="0">
<aegov-accordion-item heading="ما هو نظام التصميم الإماراتي؟">
مكتبة مشتركة من مكوّنات واجهة المستخدم مبنية وفق معيار بصري وإمكانية وصول موحّدة.
</aegov-accordion-item>
<aegov-accordion-item heading="كيف يمكنني الإبلاغ عن خطأ؟">
افتح طلب دعم على مستودع المشروع، أو تواصل مع فريق نظام التصميم.
</aegov-accordion-item>
</aegov-accordion>
</div>
</template>
import { Component } from '@angular/core';
import { AegovAccordion, AegovAccordionItem } from '@aegov/designsystem-angular';
@Component({
selector: 'app-rtl-accordion',
imports: [AegovAccordion, AegovAccordionItem],
template: `
<div dir="rtl">
<aegov-accordion [isBordered]="true" [defaultOpen]="0">
<aegov-accordion-item heading="ما هو نظام التصميم الإماراتي؟">
مكتبة مشتركة من مكوّنات واجهة المستخدم مبنية وفق معيار بصري وإمكانية وصول موحّدة.
</aegov-accordion-item>
<aegov-accordion-item heading="كيف يمكنني الإبلاغ عن خطأ؟">
افتح طلب دعم على مستودع المشروع، أو تواصل مع فريق نظام التصميم.
</aegov-accordion-item>
</aegov-accordion>
</div>
`,
})
export class RtlAccordionComponent {}
Usage
Here is the recommended usage of an accordion on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.
Use for optional or secondary content
Reach for an accordion when content is helpful but not essential to every visitor — FAQs, supporting details, optional settings. If most users need to read it, show it directly instead of hiding it behind a click.
Write a heading that stands alone
A trigger heading should make sense out of context — "Processing times", not "More info". Screen reader users often scan headings alone before deciding what to expand.
Default-open the most relevant item, sparingly
Use default-open to surface the single most important item — the top FAQ, an active step — not to open several items at once by default, which just recreates a long unstructured page.
Do not use an accordion for primary navigation
An accordion hides content behind an interaction. Primary navigation and steps a user must always see belong in a visible menu, tabs, or a stepper — not collapsed by default.
Do not bury required or safety-critical information
Fees, deadlines, eligibility requirements, or anything a user must see to complete a task should not be hidden inside a collapsed item they might never open.
Do not nest accordions more than one level deep
A single level of nesting (an accordion inside one item) is supported and has correct heading-level cascading. Nesting further nearly always signals the content should be restructured instead — deep nesting is hard to scan and hard to navigate with a keyboard.
Do not use an accordion in place of a short list
If every item's content is one short sentence, showing it directly is faster to scan than clicking through each trigger. Collapsing only earns its keep when the content is substantial enough to need hiding.
API reference
The following are the properties and references of an accordion
aegov-accordion default properties
| Attribute | Description | Type | Default |
|---|---|---|---|
| DOM id for the accordion wrapper element. Auto-generated if omitted. |
| auto-generated |
| When |
|
|
| Zero-based index of the item to open on initial render. |
| undefined |
| Toggle indicator style. |
|
|
| Adds an outer border and rounded corners around the entire accordion. |
|
|
| Heading typography size. Accepts a single token or a Tailwind-style responsive string. |
|
|
| HTML heading element (1–6) wrapping each trigger button. Cascaded to all child items; auto-incremented by 1 for a nested accordion unless set explicitly. |
|
|
aegov-accordion-item default properties
| Attribute | Description | Type | Default |
|---|---|---|---|
| Trigger text. Ignored when the |
| undefined |
| Disables the trigger so the item cannot be opened or closed. Sets |
|
|
| Set automatically by the parent | various | various |
Slots
| Component | Slot | Description |
|---|---|---|
aegov-accordion | (default) | Place one or more |
aegov-accordion-item |
| Custom heading content. Overrides the |
aegov-accordion-item | (default) | Body content shown when the item is expanded. |
Events
| Events | Description | Component | Detail |
|---|---|---|---|
| Fired when an item's trigger is activated, requesting open or close. The parent | aegov-accordion-item |
|
<aegov-accordion id="faq">
<aegov-accordion-item id="faq-a" heading="A">A</aegov-accordion-item>
<aegov-accordion-item id="faq-b" heading="B">B</aegov-accordion-item>
</aegov-accordion>
<script>
// aegov-accordion stops this event from bubbling past the item itself
// (it intercepts it internally to sync isOpen), so listen on each item
// directly rather than on the parent aegov-accordion.
document.querySelectorAll('#faq aegov-accordion-item').forEach((item) => {
item.addEventListener('aegovAccordionItemToggle', (e) => {
console.log('Item toggle requested, open =', e.detail.open, 'target =', e.target.id);
});
});
</script>
Pass-through attributes
| Attribute | Notes | Forwards to |
|---|---|---|
| Not automatically forwarded. Apply directly to | n/a |
| Not automatically forwarded. Apply directly to | n/a |
Neither component forwards attributes to inner elements — aegov-accordion.tsx's render() passes no spread props to its wrapping <div> beyond a fixed class list, and aegov-accordion-item.tsx does the same for its trigger <button>. Set attributes directly on the host element where they are needed.
Notes
The following notes are applicable of this component.
Built-in accessibility
- Each trigger renders as a real
<button>witharia-expandedreflecting the open state andaria-controlslinked to its panel. - Each panel uses
role="region"andaria-labelledbypointing at its trigger, so screen readers announce the heading–content relationship. EnterandSpacetoggle the focused item — free, native<button>behaviour, no custom key handling needed.- Arrow-key navigation (
ArrowUp/ArrowDown/Home/End) moves focus between item triggers within the same accordion, matching the WAI-ARIA Accordion pattern. A nested accordion's own triggers are handled by its own keydown listener and does not interfere with the parent's. - Collapsed panels get the HTML
inertattribute on their content wrapper. This removes every focusable descendant — buttons, links, inputs — from both the tab order and the accessibility tree in one step, so there is no focus leaking into hidden content. - Disabled items set
aria-disabled="true"on the trigger (never the nativedisabledattribute) and do not emit a toggle event when activated, but the trigger stays focusable.
Developer responsibility
The following is required for a developer to add additionally or pay attention to regarding this component.
- Provide a meaningful
heading(oraccordion-item-headingslot) on every item — without it the trigger announces to screen readers as just "button". - When using
default-open, make sure the index actually points at a real child item. aegov-accordion-itemmust always be used insideaegov-accordion. Using it standalone logs a console error and its toggle behaviour will not be wired up by any parent.
Additional notes
aegovAccordionItemToggleis dispatched withbubbles: true(verified against the compiled component —createEvent(this, "aegovAccordionItemToggle", 7), where flag7setsbubbles,composed, andcancelablealltrue) — but in practice it never reaches a bubble-phase listener on the parentaegov-accordionor beyond, because the parent's own internal listener (attached directly on each item to syncisOpen) callsstopPropagation(). Attach your listener to eachaegov-accordion-itemdirectly, or use a capture-phase listener on an ancestor if you need a single listener.heading-levelcascades from parent to children automatically, and auto-increments by 1 for an accordion nested inside another accordion's item — so a nested accordion's triggers render one heading level deeper by default, keeping the outline correct without extra configuration.- Focusable controls nested inside a collapsed panel are automatically excluded from the tab order via
inert. You do not need to manually disable or hide them.
Keyboard support
| Key | Action |
|---|---|
Enter, Space |
Toggle the focused accordion item. |
ArrowDown |
Move focus to the next accordion trigger. |
ArrowUp |
Move focus to the previous accordion trigger. |
Home |
Move focus to the first accordion trigger. |
End |
Move focus to the last accordion trigger. |
Tab |
Move focus to the next focusable element on the page. |
Shift + Tab |
Move focus to the previous focusable element on the page. |