Stacked toast notifications
Notificaciones toast apiladas · Toast stack · Stacked toasts · Snackbar · Notifiche a scomparsa
Small notices slide in from the bottom one on top of another while older ones tuck behind, shrunk like a deck of cards. After a few seconds they slip away on their own without interrupting work.
- Era
- 2008 – today
- Use
- Mainstream
Live demo
View code
<main>
<div class="app"><b></b><b></b><b></b><b class="s"></b><b class="s"></b></div>
<ol class="stack" aria-live="polite"></ol>
</main>
<script>
const st=document.querySelector('.stack'),rm=matchMedia('(prefers-reduced-motion: reduce)').matches;
const msgs=[['Salvato','Le modifiche sono al sicuro.','ok'],['File caricato','report-ottobre.pdf · 2,4 MB','ok'],['Invito inviato','Giulia riceverà un’email.','in'],['Copiato!','Link negli appunti.','ok'],['Pagamento ricevuto','Ordine n° 1042 confermato.','ok']];
let n=0;const lay=()=>[...st.children].reverse().forEach((t,i)=>{t.style.setProperty('--i',i);t.classList.toggle('gone',i>2)});
const add=()=>{const m=msgs[n++%msgs.length],li=document.createElement('li');li.className='t new '+m[2];
li.innerHTML=`<i></i><div><b>${m[0]}</b><span>${m[1]}</span></div>`;st.append(li);lay();
requestAnimationFrame(()=>requestAnimationFrame(()=>li.classList.remove('new')));
[...st.children].slice(0,-4).forEach(o=>o.remove())};
add();setInterval(add,rm?3500:1600);
</script> body{margin:0;height:100vh;overflow:hidden;background:#FAFAFA;font-family:Geist,system-ui,sans-serif;color:#18181B}
main{position:relative;height:100%;max-width:440px;margin:0 auto}
.app{padding:26px 22px;display:grid;gap:12px}
.app b{display:block;height:14px;border-radius:7px;background:#E4E4E7}
.app b:first-child{width:45%;height:22px}.app .s{width:70%}
.stack{list-style:none;margin:0;padding:0;position:absolute;left:50%;bottom:22px;width:300px;max-width:88vw;transform:translateX(-50%)}
.t{--i:0;position:absolute;bottom:0;left:0;right:0;display:flex;gap:12px;align-items:center;padding:13px 15px;background:#fff;border:1px solid #E4E4E7;border-radius:12px;box-shadow:0 10px 24px -10px #18181B33;transform-origin:50% 100%;transform:translateY(calc(var(--i)*-12px)) scale(calc(1 - var(--i)*.06));z-index:calc(10 - var(--i))}
.t i{width:22px;height:22px;border-radius:50%;background:#22C55E;flex:none;position:relative}
.t.in i{background:#18181B}
.t i::after{content:"";position:absolute;left:7px;top:5px;width:5px;height:9px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}
.t b{display:block;font-size:14px;font-weight:600}
.t span{font-size:12.5px;color:#71717A}
.t:not(:last-child) div{opacity:.0}
.new,.gone{opacity:0}
@media (prefers-reduced-motion:no-preference){
.t{transition:transform .45s cubic-bezier(.21,1.02,.73,1),opacity .35s}
.t div{transition:opacity .3s}
.new{transform:translateY(110%) scale(.96)}
.gone{transform:translateY(-40px) scale(.8)}
}
@media (prefers-reduced-motion:reduce){.t{transition:opacity .4s}} Characteristics
- Entry from below with a light spring
- Earlier messages scaled and offset behind
- At most three toasts visible
- Automatic exit after 3–5 seconds
- Stack that fans out on hover
Palette
Click a swatch to copy it
Typography
Headings · Geist Stacked toast notifications
Body · Geist Small notices slide in from the bottom one on top of another while older ones tuck behind, shrunk like a deck of cards. After a few seconds they slip away on their own without interrupting work.
Motion
- Easing
cubic-bezier(0.21, 1.02, 0.73, 1) / spring- Typical duration
- 300–400 ms ingresso e uscita; permanenza 3–5 s
- Techniques
- transform translateY e scale per indice, Sonner, react-hot-toast, aria-live polite, Web Animations API
Accessibility (reduced motion)
Toasts fade in and out in place, without sliding or scaling.
Prompt for your agent
Copy and paste into your prompt to have an agent or image generator reproduce this style.
For web pages and UI
Design the web page or interface in this style: Stacked toast notifications (Notificaciones toast apiladas, Toast stack). Small notices slide in from the bottom one on top of another while older ones tuck behind, shrunk like a deck of cards. After a few seconds they slip away on their own without interrupting work. Characteristics: Entry from below with a light spring, Earlier messages scaled and offset behind, At most three toasts visible, Automatic exit after 3–5 seconds, Stack that fans out on hover. Palette: #FAFAFA, #FFFFFF, #18181B, #22C55E, #E4E4E7, #71717A. Typography: headings in Geist, body text in Geist (Google Fonts or equivalents). Mood: clean, subtle, rational. Motion: easing cubic-bezier(0.21, 1.02, 0.73, 1) / spring, typical duration 300–400 ms ingresso e uscita; permanenza 3–5 s; techniques: transform translateY e scale per indice, Sonner, react-hot-toast, aria-live polite, Web Animations API. With prefers-reduced-motion: Toasts fade in and out in place, without sliding or scaling. References: Toast di Android (2008), Snackbar di Material Design, libreria Sonner, react-hot-toast.
Relations
Derives from
Similar to
References
- Toast di Android (2008)
- Snackbar di Material Design
- libreria Sonner
- react-hot-toast