Notifications on a toast queue outside every framework, announced through live regions, with an F6 landmark, pausing, a limit, promises and swipe.
Brief notifications that appear in a stack, announce themselves to assistive technology and close
on their own after a timeout. The toasts live in a toast queue outside every framework
(createToastManager, from the toolkit's @fragiola/primitives/toast): a plain module can create
it, import it anywhere and add toasts with no component, and the Provider renders from it. The
APG has no toast pattern: the announcements follow WAI-ARIA live regions, the keyboard follows
Base UI (an F6 landmark, Escape on a toast).
The queue: add, update, close, promise (a loading toast that becomes success or
error), newest first. The newest limit toasts show; the older ones are queued
(data-limited, inert) and show again as the newer ones close.
Timers: each toast closes timeout ms after it shows (its own, else the queue's; 0
never). A queued toast's timer waits until it shows; a loading toast has none.
Pausing: every timer pauses while the pointer is over the Viewport, while the keyboard is in
it, while the page is hidden and while a toast is swiped; each keeps what it had left.
Announcements: two live regions inside the Viewport, polite and assertive, hold the title
and description of each shown toast by its priority, appended in the order they show; an
update (a promise's result) changes the text in place. The toasts themselves are not live, so
nothing is announced twice.
Keyboard: F6 focuses the Viewport (a region landmark the app names), F6 or Shift+Tab on it
go back; each toast is a tab stop; Escape closes the focused toast, and focus moves to the next
one, else back where it was.
Swipe: a drag along the Root's swipeDirection (mouse, pen or touch) moves it
(data-swiping, --toast-swipe-movement-x / -y); past half its size, or a flick, it closes.
Stacking: --toast-index, --toast-offset-y, --toast-height and the Viewport's
--toast-frontmost-height let a stylesheet stack the toasts collapsed or expanded
(data-expanded while hovered or focused).
The queue.createToastManager({ limit, timeout }) returns a ToastManager: add(options) (returns the
id; an open toast's id updates it), update(id, updates), close(id?),
promise(promise, { loading, success, error }), toasts(), subscribe(listener). React's
Toast.useToastManager(), Vue's useToastManager() and Angular's injectToastManager() give a
component the Provider's queue, with its toasts as the framework's reactive value.
option
type
default
description
id
string
generated
the toast's id; adding an open one's id updates it
title, description
string
what it says, and what is announced
type
string
free-form (data-type); loading never closes by itself
timeout
number
the queue's
ms before it closes; 0 never
priority
"low" | "high"
"low"
announced politely, or assertively (an alertdialog)
data
Data
the app's own data
onClose, onRemove
() => void
once it closes; once it left the list after its exit
Every part also takes what the primitive contract gives:
render (Vue: as and the render slot), a class and a style, a ref, and any attribute, which
it forwards. The names below are React's; Vue and Angular bind them the same way.