Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

Toast

A transient message about something that just happened.

import { Toast } from '@loidolt/theme-svelte';

Example

Notes

  • createToaster() owns the queue, the timers, and pause-on-hover.
  • ToastViewport is the single live region — Toast carries no role="status", so nothing is announced twice.
  • action adds one follow-up button, such as Undo. It runs onAction and then dismisses the toast unless dismiss: false. Give an actionable toast time to be reached — at least ten seconds, or duration: 0.
  • toaster.update(id, patch) changes a toast in place ("Uploading…" becoming "Uploaded"). toaster.success/info/warning/error are shortcuts; error stays until dismissed unless given a duration.

Props

Generated from the component source, so it cannot drift from the implementation.

Toast props
PropTypeDefaultNotes
title required string—
action ToastAction—One follow-up button, e.g. Undo. Runs onAction, then dismisses unless told not to.
actions Snippet—Custom action area, in place of action.
children Snippet—
class string—
description string—
dismissLabel string'Dismiss notification'
duration number—Read by createToaster, not the component. Declared so {...toast} from a toaster's queue does not leak it onto the element as an attribute.
onDismiss () => void—
ref bindableHTMLDivElement | nullnull
variant StatusVariant—

Plus the attributes of HTMLAttributes<HTMLDivElement>, forwarded to the root element.