Toggle

Toggle is a flexible wrapper which provides just the slots for the content.
You can control it with the toggle: boolean flag.

<script>
    import { fade } from 'svelte/transition'
    import { Button, Toggle } from 'svelte-spectre'

    let toggle = false
</script>

<Toggle bind:toggle>
    <Button slot="toggler" on:click={() => toggle = !toggle}>
        {toggle ? 'Hide' : 'Show'}
    </Button>
    <article transition:fade>
        <h3>Toggled header</h3>
        <p>Toggled content</p>
    <article>
</Toggle>
© 2022 — 2023 BASF SE

API Toggle

<slot name="toggler">: HTMLElement | SvelteComponent
Toggle toggler
HTMLElement | SvelteComponent
<slot>: HTMLElement | SvelteComponent
Toggle content
HTMLElement | SvelteComponent
toggle: boolean = false
Toggle toggle state
true | false