enes

Expander

Control that displays a header and a collapsible content area.

Expander Title A description of the expander

This is the content of the expander.

Expander - Direction: Up

This is the content of the expander.

Disabled Expander

Usage

A basic expander expects a header and its content. You can configure the header by passing the header property. Content can be provided as child elements of the component. By default, the content container has no padding, this allows you to use 100% of the content width if needed.

<script>
  import { Expander } from 'fluentui-svelte';
</script>

<Expander header="Expander Title">
  <p>This is the content of the expander</p>
</Expander>

Controlling Expansion

Expanders can be either expanded or collapsed. This can be controlled by setting the expanded property.

Expander Title

This is the content of the expander

Opening Direction

An expander doesn’t have to expand downwards. You can control an expander’s expansion direction using the direction property. To create an upwards-expanding expander, set direction to up.

Expander Title

This is the content of the expander

Adding an Icon

You can easily add an icon to an expander’s header using the Icon prop. You can pass either a Snippet or a Component.

Expander With Icon

This is the content of the expander

Component Props

NameTypeDefaultDescription
headerstringLabel of the expander.
descriptionstringDescription to render below the header.
direction'down' | 'up''down'Set the opening direction of the expander.
justifybooleanfalseThe expander is justified to the full width of the container.
disabledbooleanfalseDisables the user interaction.
animation{ duration: number; easing: string; }The animation configuration. Reduced motion is always honoured over this.
expanded bindablebooleanfalseControl the opening state of the expander.
ref bindableHTMLDetailsElement | nullThe DOM reference of the expander element.
IconSnippet | ComponentThe icon to display before the label.
summaryRef bindableHTMLElement | nullThe DOM reference of the summary element.
summaryAttributesHTMLAttributes<HTMLElement>The HTML attributes to spread on the summary element.
Element Attributes (details)
Edit this Doc View as Markdown