Skip to content

a-toast

Implemented with Toast.

Toast

A single toast element.

Example


import "@sv/elements/toast";
// create a toas and keep a reference to it
const toast = new Toast({ message: "A Message" });
const feed = ToastFeed.getInstance(); // the a-toast-feed element
feed?.append(toast);
// optionally slot any content into the toast
toast.innerHTML = `
<span>Custom HTML content</span>
`;

Events


Name Description
killed

Fires when the toast is killed.

Methods


Toast.kill()

src/Toast.ts:206

Kills the toast and removes it from the DOM.

ToastFeed

A feed of toast elements. Handles the positioning and animations of the toasts.

Example


import "@sv/elements/toast";
<a-portal>
<a-toast-feed class="fixed right-12 bottom-12 text-base" />
</a-portal>