A very simple implementation of a toast component in Svelte.
The component is intended to be copied into your project rather than installed via NPM.
<script>
import Toast, { toast } from "./components-or-whereever/Toast.svelte";
</script>
<button
on:click={() => {
toast.show("Toast message", {
x: "left",
y: "top",
type: 'success'
});
}}
>
Show toast!
</button>
Toast.svelte
and call .show
to create a toast.It should be very easy to alter the functionality or the design of the component by editing the code directly.