Back to Fluentui

Accordion

packages/web-components/src/accordion/README.md

4.40.2-hotfix23.7 KB
Original Source

Accordion

As defined by the W3C:

An accordion is a vertically stacked set of interactive headings that each contain a title, content snippet, or thumbnail representing a section of content. The headings function as controls that enable users to reveal or hide their associated sections of content. Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page.

Design Spec

Link to Accordion Design Spec in Figma

Engineering Spec

Fluent WC3 Accordion extends from the FAST Accordion and is intended to be as close to the Fluent UI React 9 Accordion implementation as possible. However, due to the nature of web components there will not be 100% parity between the two.

Class: Accordion

Component Name

Accordion

Variables

NameDescriptionType
AccordionExpandModeExpand mode for Accordion{ single: "single", multi: "multi" }

Fields

NamePrivacyTypeDefaultDescription
expandmodepublicAccordionExpandModemultipleControls the expand mode of the Accordion, either allowing single or multiple item expansion.
AccordionItemsprotectedElement[]

Methods

NamePrivacyDescriptionParametersReturnInherited From
expandmodeChangedpublicprev: AccordionExpandMode, next: AccordionExpandMode

Events

NameTypeDescriptionInherited From
changeFires a custom 'change' event when the active item changes

Attributes

NameField
expand-modeexpandmode
<hr />

Accessibility

W3 Accordion Spec

WAI-ARIA Roles, States, and Properties

<hr />

Preparation

Fluent Web Component v3 v.s Fluent React 9

Component and Slot Mapping

Fluent UI React 9Fluent Web Components 3
<Accordion><fluent-accordion>

Property Mapping

Fluent UI React 9Fluent Web Components 3Description of difference
defaultOpenItems: numberexpand: booleandefaultOpenItems is a number property set on the Accordion corresponding to the intended AccordionItem to be expanded.<hr /> expand is a boolean property set directly on the AccordionItem intended to be expanded
multiple: booleanexpand-mode: "single" | "multiple"