Create

General

Accordion

Copy page View as Markdown Open in ChatGPT Open in Claude

A vertically stacked set of interactive headings that each reveal a section of content.

Usage#

app.component.ts
import { WDS_ACCORDION } from '@wds/angular/accordion';

Examples#

Default#

value expands the sections with these values; in HTML it is a space-separated list.

We offer standard (3–5 business days), express (2–3 days) and next-day delivery.

International shipping is available to over 100 countries.

You have 30 days to return an item. It must be unused and in its original packaging.

Refunds reach your account within 5–7 business days after we receive the package.

Email us, use the live chat or call. We reply within 24 hours.

Basic#

Yes. It follows the WAI-ARIA Accordion pattern: buttons with aria-expanded, regions named by the header and arrow-key navigation. Yes. It matches the other components and uses the --wds-* tokens. Yes. It expands smoothly, and without animation with prefers-reduced-motion.

Borders#

Any border and padding can be set with classes on the elements.

A list of sections that expand when you click their header. When there is a lot of content and users usually need only part of it, e.g. in an FAQ. Yes, with type="multiple".

Card#

Common questions about your plan, payments and cancellation. Starter ($9/month), Pro ($29/month) and Enterprise (custom pricing). Each has a 14-day trial. You pay monthly or yearly in advance (two months free). The invoice arrives by email. Yes. You keep access until the end of the paid period, with no extra fees.

Disabled#

A disabled section cannot be expanded and is skipped by the arrow keys.

Yes, until the order ships. This content cannot be expanded. The tracking number arrives by email with the shipping confirmation.

Multiple#

type="multiple" lets several sections stay open. wds-open-change reports the toggled item, its open state and all expanded sections.

A list of sections that expand when you click their header.When there is a lot of content and users usually need only part of it.Yes, with type="multiple".

Expanded: item-1, item-2

Not collapsible#

In single mode collapsible="false" keeps one section always open.

A list of sections that expand when you click their header. When there is a lot of content and users usually need only part of it, e.g. in an FAQ. Yes, with type="multiple".

API References#

wds-accordion#

A list of expandable sections (wds-accordion-item). In single mode one section is expanded at a time, in multiple any number. Arrow Up/Down, Home and End move focus between the headers.

Attributes

AttributeTypeDefaultDescription
typeWdsAccordionType'single'single: one expanded section, multiple: any number.
collapsiblebooleantruesingle mode: whether the expanded section collapses on another click. Yes by default; in HTML turn it off with collapsible="false".
valuestring[]Values (value) of the expanded sections. In HTML a space-separated list: value="a b".
disabledbooleanfalseDisables every section.

Events

EventDescription
wds-open-changeCustomEvent<WdsAccordionOpenChangeDetail>The user expanded or collapsed a section.

Slots

SlotDescription
(default)wds-accordion-item sections.

wds-accordion-item#

A section of wds-accordion (or wds-accordion-multiselect): a header with a button and expandable content. The button has aria-expanded and aria-controls, and the content is a role="region" named by the header. The state is in data-state="open|closed".

Attributes

AttributeTypeDefaultDescription
valuestring''Section identifier in the value / expanded of the parent. Without it the section gets an automatic one.
headingstring''Section title.
levelnumber3Heading level (aria-level), 3 by default.
disabledbooleanfalseDisables expanding this section.

Methods

MethodDescription
focus(options?: FocusOptions)

Slots

SlotDescription
(default)Section content.
headingSection title (instead of the heading attribute).

CSS parts (::part)

PartDescription
headingThe heading element (role="heading").
triggerThe expand button.
titleThe title in the button.
countCount of selected options (only in wds-accordion-multiselect).
iconThe chevron.
contentThe expandable region.
bodyInner content container (padding).

CSS custom properties

PropertyDescription
--wds-accordion-durationAnimation duration (default 200ms).

Accessibility#

Screen reader#

Each wds-accordion-item header is a native <button> inside an element with role="heading" (level sets aria-level, default 3). The button has aria-expanded and aria-controls.

The content has role="region" named by the header button; when collapsed it is hidden from screen readers and from the tab sequence.

A disabled section has a disabled native button, skipped by Tab and the arrow keys. The open section that cannot be collapsed (collapsible="false") keeps its button focusable with aria-disabled="true".

Keyboard support#

KeyFunction
TabMoves focus to the next header button, or into the expanded content.
EnterSpaceExpands or collapses the focused section.
ArrowDownArrowUpMoves focus to the next or previous header, wrapping around; disabled sections are skipped.
HomeEndMoves focus to the first or last header.
Footer