npm install sourdough-toast
import { boot, toast } from "sourdough-toast";
window.addEventListener("DOMContentLoaded", () => boot());
toast("Hi!");
<script type="module">
import { boot, toast } from "https://esm.run/sourdough-toast";
window.addEventListener("DOMContentLoaded", () => boot());
window.toast = toast;
</script>
<button onclick="toast('hi!')">Toast</button>
| Key | Default | Description |
|---|---|---|
maxToasts |
3 |
Max number of non-persistent toasts on screen |
duration |
4000 |
How fast toasts disappear |
width |
356 |
Width of the toasts (on desktop) |
gap |
14 |
Distance between stacked toasts |
theme |
"light" |
Or dark |
viewportOffset |
32 |
Distance to edge of window |
expandedByDefault |
false |
Don't stack toasts |
yPosition |
"bottom" |
Or "top" |
xPosition |
"right" |
Or "left" or "center" |
richColors |
false |
More colorful toasts |
closeButton |
false |
Show close button |
persist |
false |
Keep a toast visible until dismissed. Persistent toasts always show a close button and do not count toward maxToasts. |
Made by mikker.