Skip to content
Search
Search the documentation
Accordion
GitHub
1 min read

Accordion

Collapse long-form content behind expandable headings.

Fold FAQs, optional details, or long asides behind a heading the reader expands on demand, one panel at a time by default, so the page stays scannable.

Usage

Each AccordionItem takes a title (the always-visible summary) and claims its own value automatically, so you never wire up ids. Leave blank lines around the panel content so mdsvex parses the markdown inside.

			<script>
	import { Accordion, AccordionItem } from 'svelte-docsmith';
</script>

<Accordion>
	<AccordionItem title="First question">

Answer with full **markdown**, including `code` and [links](/docs/theming).

	</AccordionItem>
	<AccordionItem title="Second question">

Another answer.

	</AccordionItem>
</Accordion>
		

Pass multiple to let panels stay open independently:

			<Accordion multiple>
	<!-- items -->
</Accordion>
		

API reference

Accordion

Accordion
multiple boolean default false
Allow several panels open at once.
children required Snippet
One AccordionItem per panel.

AccordionItem

AccordionItem
title required string
The heading that toggles the panel.
children required Snippet
The panel content.

Was this page helpful?