Collapsible.svelte 396 Bytes
Newer Older
1
<script lang="ts">
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
2
3
	import { slide } from 'svelte/transition';
	import { quintOut } from 'svelte/easing';
4
	export let open = false;
5
	export let className = '';
6
7
</script>

8
9
<div class={className}>
	<button on:click={() => (open = !open)}>
Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
10
		<slot />
11
12
	</button>

Timothy J. Baek's avatar
refac  
Timothy J. Baek committed
13
14
15
16
17
18
	{#if open}
		<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
			<slot name="content" />
		</div>
	{/if}
</div>