Basic Toast
A transient, auto-dismissing confirmation announced politely.
6 个框架中级
The inbox behind the bell - everything the toasts already discarded.
<!--
The panel is the notification system's memory: everything the toasts already
showed and threw away. That difference drives the markup.
- No live region. Nothing here is breaking news; the user opened this panel
deliberately. Announcing a list they asked to read would be noise.
- <ul>, not a stack of divs. Now a screen reader says "list, 3 items" and
arrow keys work.
- Unread is marked with a dot AND the word "Unread" in a visually hidden
span. The dot alone is colour-only signalling.
-->
<section class="panel" aria-labelledby="panel-heading">
<header class="panel__head">
<h2 class="panel__title" id="panel-heading">Notifications</h2>
<button class="panel__mark" type="button">Mark all read</button>
</header>
<ul class="panel__list">
<li class="panel__item panel__item--unread">
<span class="panel__dot" aria-hidden="true"></span>
<a class="panel__link" href="/deploys/9f2">
<span class="panel__sr">Unread. </span>
<span class="panel__text">Deploy #914 finished in 42s</span>
<span class="panel__time">2m ago</span>
</a>
</li>
<li class="panel__item">
<span class="panel__dot" aria-hidden="true"></span>
<a class="panel__link" href="/invites/7c1">
<span class="panel__text">Dana accepted your invite</span>
<span class="panel__time">1h ago</span>
</a>
</li>
</ul>
</section>| Prop | 类型 | 默认值 | 说明 |
|---|---|---|---|
items必填 | PanelNotification[] | - | 要渲染的项目数组。 |
onSelect | (id: string) => void | - | 用户选择菜单项时触发,参数为所选项。 |
onDismiss | (id: string) => void | - | 用户关闭通知时触发。 |
className | string | - | 合并到根元素上的额外类名。 |
Deliberately has no live region: the user opened this, so nothing in it is an interruption. Mark rows read on open only if opening really is reading - if the list is long enough to scroll, mark on click instead, or people lose things they never saw. Keep the unread dot paired with its visually hidden "Unread", and render the dot transparently rather than conditionally so the text never shifts when a row changes state.