Accordions
Svelte ComponentDivide content into collapsible sections.
Import
Package
Source
Doc
WAI-ARIA
Examples
This is the content panel for the books item.
Getting Started
Create an accordion and add as many child item as you wish.
<Accordion>
<AccordionItem open>
<svelte:fragment slot="lead">(lead)</svelte:fragment>
<svelte:fragment slot="summary">(summary)</svelte:fragment>
<svelte:fragment slot="content">(content)</svelte:fragment>
</AccordionItem>
<AccordionItem>
<svelte:fragment slot="lead">(lead)</svelte:fragment>
<svelte:fragment slot="summary">(summary)</svelte:fragment>
<svelte:fragment slot="content">(content)</svelte:fragment>
</AccordionItem>
<!-- ... -->
</Accordion>
Auto-Collapse Mode
Enable the autocollapse
setting to limit display to one accordion panel at a time.
<Accordion autocollapse>...</Accordion>
Open Item Behavior
If autocollapse
is disabled, you can set open
to any items-center you wish to be open by default.
If
autocollapse
is enabled, the last item with the open
prop will be open by default.
<AccordionItem open>...</AccordionItem>