Collapsible
Installation
npx @mielui/svelte add collapsibleyarn dlx @mielui/svelte add collapsiblebunx @mielui/svelte add collapsibleUsage
Compose Trigger and Content inside Root. Bind open to control the panel from elsewhere on the page, and set disabled on Root to prevent toggling. The content transition respects reduced motion.
Trigger is the shared disclosure row used by Accordion, Reasoning, and Tool. It sizes to its content; add w-full justify-between for a full-width row. For a chevron, put a 14px ArrowDown01Icon after the label and rotate it 180 degrees while open, as the first example does.
<script lang="ts">
import * as Collapsible from '@mielui/svelte/components/collapsible';
let open = $state(false);
</script>
<Collapsible.Root bind:open>
<Collapsible.Trigger>Delivery details</Collapsible.Trigger>
<Collapsible.Content>Delivery takes 3 to 5 business days.</Collapsible.Content>
</Collapsible.Root>Examples
Meeting notes
A full-width trigger with a chevron opens a paragraph and a list of action items.
The export flow is ready for testing. Maya owns the migration guide, and Sam will review keyboard navigation before Friday.
- โข Ship the studio redesign by end of quarter
- โข Draft v2 migration guide for customers
- โข Review pricing experiment results with finance
Default
Parts
Trigger can hold any content, so a chevron that turns when the section opens goes right beside its label.
Root renders no element of its own; it holds the open state. Trigger and Content render their children and take class, and Trigger passes button attributes such as id.
API reference
Collapsible.Root
Controls collapsible content state.
openBindablebooleanWhether it is open. Bind it to control the state from outside.
Default
falsedisabledbooleanPrevents opening and closing.
Default
falsechildrenSnippet<[]>Content rendered inside.
Collapsible.Content
Contains collapsible content.
childrenSnippet<[]>Content rendered inside.
classstringClasses added to the element.
Collapsible.Trigger
Toggles the content.
childrenSnippet<[]>Content rendered inside.
class(string & (ClassValue | null))Classes added to the element.
pnpm dlx @mielui/svelte add collapsible