Collapsible
A vertically collapsible component that expands downward.
Import
import Collapsible from "$lib/components/Collapsible.svelte"; Basic Example
Repositories
Repository 1
Repository 2
<Collapsible title="Repositories">
<div class="rounded-md bg-background-alt p-4">
Repository 1
</div>
<div class="rounded-md bg-background-alt p-4">
Repository 2
</div>
</Collapsible>Styled Example
Custom Styled Collapsible
Custom content here
More content here
<Collapsible
title="Custom Styled Collapsible"
trigger_class="bg-texas-rose-500 text-white hover:bg-texas-rose-600"
content_class="bg-background-alt rounded-md p-4"
>
<div class="space-y-2">
<p>Custom content here</p>
<p>More content here</p>
</div>
</Collapsible>Clickable Items Example
Clickable Items
<Collapsible title="Clickable Items">
<div
class="rounded-md bg-background-alt p-4 cursor-pointer transition-colors hover:bg-background-hover"
on:click={() => alert('Clicked Repository 1')}
>
Repository 1
</div>
<div
class="rounded-md bg-background-alt p-4 cursor-pointer transition-colors hover:bg-background-hover"
on:click={() => alert('Clicked Repository 2')}
>
Repository 2
</div>
</Collapsible>Properties
Name
Type
Description
title
Type
string
Default: undefined
The title text shown in the header.
class_name
Type
string
Default: ""
Additional classes for the root element.
trigger_class
Type
string
Default: ""
Additional classes for the trigger button.
content_class
Type
string
Default: ""
Additional classes for the content container.