open-webui/src/lib/components/common/Collapsible.svelte

19 lines
396 B
Svelte
Raw Normal View History

<script lang="ts">
2024-07-06 04:37:29 +00:00
import { slide } from 'svelte/transition';
import { quintOut } from 'svelte/easing';
export let open = false;
export let className = '';
</script>
<div class={className}>
<button on:click={() => (open = !open)}>
2024-07-06 04:37:29 +00:00
<slot />
</button>
2024-07-06 04:37:29 +00:00
{#if open}
<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
<slot name="content" />
</div>
{/if}
</div>