Feedback
Toast
Transient feedback that doesn't block the UI. Toasts auto-dismiss after a few seconds and stack in the bottom-right corner. Use Alert for messages that should stay put.
Setup
Render <Toaster /> once, near the root of your layout. It manages its own
portal and listens for everything toast.x() emits:
src/routes/+layout.svelte svelte
<script lang="ts">
import { Toaster } from '@lyeve-labs/ui-kit';
let { children } = $props();
</script>
{@render children()}
<Toaster />Showing a toast
Import toast from anywhere (components, load functions, async handlers) and call:
Custom timeout
toast.success('Saved.', 1500); // dismiss after 1.5s
toast.error('Pinned error', 0); // 0 disables auto-dismissProgrammatic dismiss
Every toast.x() returns the new toast id, which you can pass to dismiss():
const id = toast.info('Uploading...', 0);
// later, when the upload finishes:
toast.dismiss(id);API
The kit has no Toast component. This page documents the toast function, which shows a
toast from anywhere in your code. The toasts render in Toaster, which takes no props.
| Prop | Type | Default | Description |
|---|---|---|---|
toast.info(message, timeout?) | (string, number?) => number | no default | Show an informational toast in the brand tone. Returns the id. The toast records its tone as "brand", which is the canonical name for the cyan tone across the kit. |
toast.success(message, timeout?) | (string, number?) => number | no default | Show a success toast. |
toast.warn(message, timeout?) | (string, number?) => number | no default | Show a warning toast. |
toast.error(message, timeout?) | (string, number?) => number | no default | Show an error toast. |
toast.dismiss(id) | (number) => void | no default | Dismiss a specific toast by id. |
timeout | number | 4000 | Auto-dismiss in milliseconds. Use 0 to keep the toast until dismissed. |