Toast
A stack of alerts pinned to a corner of the screen.
| Name | Type | What it does |
|---|---|---|
toast | component | Fixed container, bottom right by default. Its children animate in |
toast-top | modifier | Top edge |
toast-start | modifier | The start edge: left, or right in right-to-left pages |
toast(message, options) | component | From behaviors.js: adds a message to the stack and removes it after a while. Options: type, duration, top, start |
The function builds the stack for you and announces messages to screen readers. The message is inserted as text, never as HTML.
Toast
Copied to clipboard.
2 files uploaded.
<div class="toast">
<div class="alert alert-success" role="status">Copied to clipboard.</div>
<div class="alert" role="status">2 files uploaded.</div>
</div>From script
<button class="btn" id="save">Save</button>
<script type="module">
import { toast } from "glimmer-ui/behaviors.js";
document.getElementById("save").onclick = () => toast("Saved.", { type: "success" });
</script>