Live playground
Toast notifications
Try toast-queue in the browser. Framework-agnostic, customizable, and built on modern web APIs with progressive enhancement and graceful fallbacks.
toast-queue
Live playground
Try toast-queue in the browser. Framework-agnostic, customizable, and built on modern web APIs with progressive enhancement and graceful fallbacks.
Documentation
Add accessible toast notifications to any modern web app with a small, framework-agnostic API. Start with the quick example, then customize the queue and presentation to match your application.
Install toast-queue from npm:
Create a queue and add a toast.
That's it. toast-queue handles the queue lifecycle, positioning, dismissal, interaction states, and screen-reader announcements for you.
For simple messages, pass a string to .add(). For richer notifications, pass an object containing a title and description.
Configure the queue when you create it. You can control where toasts appear, how long they remain visible, and how many are considered visible at once.
Choose from six logical positions:
top-start, top-center,
top-end, bottom-start,
bottom-center, and bottom-end. You can also change the position after creating the queue.
visibleLimit
controls how many toasts are considered visible at the same time. Additional toasts remain rendered in the queue and are marked hidden
[data-hidden]
until the visible limit allows them to be shown.
Individual toasts can customize their behavior by passing options as the second argument to .add().
Set duration to 0 when a toast should remain visible until it is dismissed by the user or your application.
toast-queue
provides the queue behavior, accessibility primitives, interaction states, and sensible structural styles. It does not impose a visual design system.
Customize the component with the data-part attributes exposed by the toast markup. Styling hooks and CSS custom properties are also available for queue-level positioning and interaction effects.
Use logical offset variables to control the distance from the viewport.
Optional CSS presets provide ready-made layouts without taking control away from your application.
Presets are layered under @layer toast-queue, so your own styles can override them.
Load the package directly from a CDN. This is useful for static sites, prototypes, and progressively enhanced applications.
Toasts are announced to assistive technologies when supported by the browser. The queue also manages interaction states so a toast can be inspected or interacted with without being immediately dismissed.
toast-queue
uses modern browser APIs and progressively enhances them. Where supported animation or transition APIs are unavailable, the toast still renders and remains functional.
If ariaNotify() is not available, you can load the
@github/arianotify-polyfill
conditionally before creating the queue:
For the complete API, including queue options, toast options, methods, properties, and template hooks, see the API reference.