Helper
Svelte
Optional Toaster plus svelte/toast for component icons and custom().
Live demo and install on this page. Step-by-step guide:Svelte docs.
Try it
Same core toast API this stack uses.
Mode: success · position top-right · richColors on
Install snippet
<script>
import Toaster from "alert-notify/svelte";
import { toast, custom } from "alert-notify/svelte/toast";
import Icon from "./Icon.svelte";
</script>
<Toaster position="top-right" richColors />
<button onclick={() => toast.success("Saved")}>Save</button>
<button
onclick={() =>
toast.info("Pay with card", {
icon: { component: Icon, props: { name: "card" } },
})
}
>
With icon
</button>- Import toast and custom from alert-notify/svelte/toast.
- custom({ component, props }) mounts a Svelte component into the toast body.
- Peer: svelte >= 5.