Toast
Call toast() from any component.
Toasts stack at the bottom of the screen, pause while hovered, and can carry action
buttons.
Installation
Copy the command below and run it in your terminal.
Usage
Mount <Toaster /> once in your root
layout; toast() does nothing until one is
mounted. Toasts close after 5.6 seconds unless you pass duration.
Examples
All types
Trigger toast notifications:
Anatomy
Toast - Renders a single notification.
Toaster - Hosts the toast stack. Mount it once; toast() needs it.
<script lang="ts"> import { Button } from '@sivir-ui/svelte/components/button'; import { toast } from '@sivir-ui/svelte/components/toast'; function deploy() { toast.success('Deployment ready', { description: 'sivir.dev is now live.', actions: [ { label: 'Visit', callback: () => { window.open('https://sivir.dev', '_blank'); } } ] }); } </script> <div class="flex items-center justify-center"> <Button onclick={deploy}>Deploy</Button> </div>