Skip to content
Knsept
Free playbook

Stacking toasts

Accessible toast notifications that stack, auto-dismiss, and pause while you hover.

JavaScriptUI Widgets Updated Sep 18, 2026
Live demo Reduced motion is on, so effects are toned down
<button class="toast-trigger" type="button">Show a toast</button>
<ol class="toasts" aria-live="polite"></ol>

Toasts live in an aria-live="polite" list, so screen readers announce them without stealing focus. Hovering pauses the countdown and resumes it with the remaining time, not a fresh one. Tapping or clicking a toast dismisses it, so touch users aren't stuck waiting.

Text is set with textContent, never innerHTML, so a toast can safely show user-supplied strings.

Reuse it: call showToast('Your message', 5000) from anywhere.

More from the library

Feedback live

Loading-state button

A submit button that shows a spinner while it works, then success or an error, without changing width.

Feedback live

Confetti burst

A celebration burst from a button, drawn on a canvas with simple physics. Under 60 lines, no library.

Feedback live

Progress ring

A circular progress indicator from one SVG circle and stroke-dasharray, with an accessible progressbar role.