This feature is currently available as an early access Beta
preview, meaning the features and API are not yet stable. This feature is not yet recommended for production use as breaking changes may occur. Please use this feature with caution.
Setup the Provider
Wrap the contents of your app with ToastProvider
in your root layout. We’ll interface with this using the Svelte Context API.
<script lang="ts"> import { ToastProvider } from '@skeletonlabs/skeleton-svelte';</script>
<ToastProvider> {@render children()}</ToastProvider>
Create a Toast
There are three available types of toasts: info | error | success
, with info
being the default.
API Reference
ToastProvider
The list of available component props.
placement?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
(defaultbottom-end
)offset?: string;
- Offset from the viewport edge. (default:16px
)dismissLabel?: string;
- The dismiss button label text. (default×
)
Toast
Supply these values within toast.create()
.
title?: string;
- The unique toast title text.description: string;
- The unique toast description text.type?: 'info' | 'error' | 'success';
- Define the toast type. (defaultinfo
)duration?: number;
- The duration of the toast. Default varies by type.