Toast

Transient server outcomes in a polite region with timed dismissal and a bounded queue.

Each accepted save adds a keyed toast; hover or focus pauses its dismissal.

Open in new tab

Each preview is its own Live page in a frame, because this site is a Vue 3.5 app built on the Pulsar starter kit. An open list or popover stays inside its frame; in your application it opens over the page.

Installation

bash
suprnova live:add toast

Usage

html
{% import "suprnova-ui/toast/toast.html" as toast %}
{% call toast::toast_region("notices") %}{% for notice in notices %}{% call toast::toast(notice.key, notice.text) %}{% endcall %}{% endfor %}{% endcall %}

Examples

Persistent error

A refused demo save produces both an error toast and a persistent alert; retry clears the alert.

Open in new tab

Keyboard and accessibility

suprnova.toast - transient outcomes in one polite live region (FDB-004). The region announces each toast once as it enters and never takes focus; sn-toast-region times each toast out after its duration, pauses while hovered or focused, hides toasts beyond the region's limit until a slot frees, and answers the dismiss button. A toast is keyed and preserved, so the browser owns its hidden state across a morph and a dismissed toast stays dismissed. Critical errors belong in an alert as well; a toast is never their only surface. Toasts render inside a loop, so the key passes through the live_key filter: the island that mounts them exposes `pub mod filters { pub use suprnova::view::filters::live_key; }`.

API reference

toast_region

ParameterDefaultDescription
idRequiredThe polite live region's unique element id.
label"Notifications"The accessible name of the notification region.
limit3The maximum number of visible toasts; later arrivals wait for a slot.

toast

ParameterDefaultDescription
keyRequiredA unique stable key checked by live_key and preserved across morphs.
textRequiredThe message announced without moving focus.
variant"info"info, success, warning or error; critical errors also need a persistent surface.
duration6000Milliseconds before dismissal, paused while hovered or focused.