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.
fluent-accordion
Setup
import {
provideFluentDesignSystem,
fluentAccordion,
fluentAccordionItem
} from "@fluentui/web-components";
provideFluentDesignSystem()
.register(
fluentAccordion(),
fluentAccordionItem()
);
Example
Additional Resources
FluentAccordion
<FluentAccordion>
wraps the <fluent-accordion>
element, a web component implementation of an accordion leveraging the Fluent UI design system. It uses the <FluentAccordionItem>
component for defining the individual accordion items
Usage
@using Microsoft.Fast.Components.FluentUI
<FluentAccordion>
<FluentAccordionItem Expanded="true">
<span slot="heading">Panel one</span>
Panel one content
</FluentAccordionItem>
<FluentAccordionItem>
<span slot="heading">Panel two</span>
Panel two content
</FluentAccordionItem>
<FluentAccordionItem Expanded="true">
<span slot="heading">Panel three</span>
Panel three content
</FluentAccordionItem>
</FluentAccordion>
Example
See the component in action with implementation examples at the Blazor demo site.