Accordions
Svelte ComponentDivide content into collapsible sections.
Import
Package
Source
Doc
WAI-ARIA
Examples
Icon Heading
Icon Heading
The content for the first element.
Avatar Heading
Avatar Heading
The content for the second element.
Numeral Heading
Numeral Heading
The content for the third element.
Getting Started
A standard AccordionGroup that only allows one AccordionItem to be open at once.
<AccordionGroup>
<!-- Open -->
<AccordionItem open>
<svelte:fragment slot="lead">(lead)</svelte:fragment>
<svelte:fragment slot="summary">(summary)</svelte:fragment>
<svelte:fragment slot="content">(content)</svelte:fragment>
</AccordionItem>
<!-- Closed -->
<AccordionItem>
<svelte:fragment slot="summary">(summary)</svelte:fragment>
<svelte:fragment slot="content">(content)</svelte:fragment>
</AccordionItem>
</AccordionGroup>
Using Collapse
If you do not wish for the AccordionItem, set the collapse
property to false
.
<AccordionGroup collapse={false}>
<!-- Open -->
<AccordionItem open>
<svelte:fragment slot="lead">(lead)</svelte:fragment>
<svelte:fragment slot="summary">(summary)</svelte:fragment>
<svelte:fragment slot="content">(content)</svelte:fragment>
</AccordionItem>
<!-- Closed -->
<AccordionItem>
<svelte:fragment slot="summary">(summary)</svelte:fragment>
<svelte:fragment slot="content">(content)</svelte:fragment>
</AccordionItem>
</AccordionGroup>