1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: Toast
summary: >-
A fixed bottom-right flash bar — the real pattern used for delete
confirmations. Auto-dismisses after roughly 8 seconds in practice; wire
that timer into the consuming app.
---
## Basic
`role="status"` is the correct live-region role for a transient status
message, so it doubles as the entire styling hook — no base class. The
example below stays in document flow so it does not cover the page;
`[data-fixed]` is what actually pins it bottom-right in a real app. The
action and dismiss buttons are plain `<button>`s told apart by
`aria-label="Dismiss"`, an attribute the icon-only close control needs
anyway.
<figure class="example">
<figcaption>Toast</figcaption>
<div>
<div role="status">
<span>Deleted "Call Mom"</span>
<button>Undo</button>
<button aria-label="Dismiss">×</button>
</div>
</div>
<details open><summary>Markup</summary>
<pre><code><div role="status">
<span>Deleted "Call Mom"</span>
<button>Undo</button>
<button aria-label="Dismiss">×</button>
</div></code></pre>
</details>
</figure>
## Without an action
<figure class="example">
<figcaption>No action</figcaption>
<div>
<div role="status">
<span>Series created</span>
<button aria-label="Dismiss">×</button>
</div>
</div>
<details><summary>Markup</summary>
<pre><code><div role="status">
<span>Series created</span>
<button aria-label="Dismiss">×</button>
</div></code></pre>
</details>
</figure>
## API
<table>
<thead><tr><th scope="col">Element / attribute</th><th scope="col">Values</th><th scope="col">Notes</th></tr></thead>
<tbody>
<tr><td><code>[role="status"]</code></td><td></td><td>Required base, on a <code><div></code>.</td></tr>
<tr><td><code>> span</code></td><td>string</td><td>The message. Required.</td></tr>
<tr><td><code>> button</code></td><td></td><td>Renders a destructive-colored action, typically "Undo".</td></tr>
<tr><td><code>> button[aria-label="Dismiss"]</code></td><td></td><td>The × control — the label is what tells it apart from the action button.</td></tr>
<tr><td><code>data-fixed</code></td><td>boolean</td><td>Pins the toast bottom-right of the viewport. Omit to stay in document flow.</td></tr>
</tbody>
</table>