Toast

Toasts are used to show alert or information to users.

Add a container element with the toast class. You can add any text within the container, and even icons. You may also add a close button with the btn-clear class if you need.

Single
header
I'm pure static Toast

Toaster

<script>
    import { Toast, Toaster, toast } from 'svelte-spectre'

    let visible = true

    function sendToast() {
        toast.send({
            msg: 'msg', pos: 'pos',
            timeout: 'timeout',
            type: 'type',
            icon: 'icon',
            closable: true,
            invert: false,
            reverse: false
        })
    }
</script>

{#if visible}
    <Toast
        bind:visible
        type="initial"
        icon="arrow-right"
        timeout={3000}
        closable={true} />
{/if}

<button on:click={sendToast}>sendToast</button>
<Toaster />
© 2022 — 2023 BASF SE

API Toast

type: Colors = "initial"
Toast type
initial | primary | success | warning | error
icon: Icons = ""
Toast icon
any icon
closable: boolean = true
Toast closable
true | false
timeout: number = 0
Toast timeout in ms
any number
visible: boolean = true
Toast visible
true | false
invert: boolean = false
Toast invert
true | false
reverse: boolean = false
Toast reverse
true | false