A component as well as a utility for displaying temporary, popup toast
messages. This consists of the
<Toasts />
component, and the
toaster
utility. The component serves only as a container for the toasts, and only one
is needed. If you are using SvelteKit, it would generally go in your root +layout.svelte
file. Otherwise, it can go in any root component, as long as it appears on every
page.
toaster
provides four methods for the four available message types:
info
,
success
,
warning
, and
error
. The only difference between the types is the background color. All four functions
take in a string as a parameter, which will be the message that gets displayed.
Toasts will be automatically dismissed 8 seconds after they are displayed, and
will show a countdown progress indicator while they are active. They can also
be dismissed early by clicking anywhere in the toast body.