Notification Inbox List
A bell with an unread count opens a list; clicking an item marks it read, and Mark all read clears the badge.
AI prompt
Clean UI design of a notification dropdown below a bell icon with a red count badge 3: a white rounded panel with a header Notifications and a link Mark all read, four rows each with a small round avatar, a bold title, one grey line of detail, a time on the right and a blue unread dot on the first three, thin dividers, soft shadow, light theme, flat modern style. Variants: all read with no badge, and an empty state. Negative: heavy borders, gradients, text errors, sound icons, clutter. Reduced motion: static design.About this pattern
Definition
A notification inbox keeps messages that would otherwise vanish as toasts. Unread items have a dot and heavier text, reading one removes the dot, and the bell badge always shows how many remain so the user can decide when to look.
Purpose & UX principles
- Newest first, with a short title, one line of detail and a time.
- Clicking or pressing Enter on an item marks it read and would open its target.
- Mark all read is a single action; never remove items automatically.
Interaction states
- Bell button, four items, Mark all read, and Reset demo.
Motion specification
- Panel fades and slides 6px over 150ms; the badge pops when it changes.
- Reduced motion: no fade, slide or pop.
Responsive behaviour
- The panel is a popover: Escape closes it and focus returns to the bell.
- Announce the unread count in the bell's accessible name.
Code
<div class="bx"><div class="tb"><button class="mini" id="rs" type="button">Reset demo</button><button class="bl" id="bl" type="button" aria-haspopup="true" aria-expanded="false"><svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M6 17V11a6 6 0 0 1 12 0v6l2 2H4z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M10 21a2 2 0 0 0 4 0" fill="none" stroke="currentColor" stroke-width="2"/></svg><b id="bg"></b></button></div><div class="pn" id="pn" hidden><div class="ph"><b>Notifications</b><button class="lk" id="ma" type="button">Mark all read</button></div><ul id="ls"></ul></div><button class="mini" id="rs" type="button">Reset demo</button></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tb{display:flex;justify-content:flex-end}.bl{position:relative;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;border:1px solid var(--line);background:var(--surface)}.bl b{position:absolute;right:-4px;top:-4px;min-width:18px;height:18px;border-radius:99px;background:#e5484d;color:#fff;font-size:11px;display:grid;place-items:center;padding:0 4px}.bl b:empty{display:none}.bl b.pop{animation:pp .25s}
@keyframes pp{50%{transform:scale(1.3)}}
.pn{border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:0 10px 24px rgba(0,0,0,.12);overflow:hidden;animation:in .15s}.pn[hidden]{display:none}@keyframes in{from{opacity:0;transform:translateY(-6px)}}
.ph{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-bottom:1px solid var(--line);font-size:13px}.lk{font-size:12px;color:#2b59d6;font-weight:600}.lk:disabled{color:var(--muted);cursor:default}
.pn ul{list-style:none}.pn li button{width:100%;text-align:left;display:grid;grid-template-columns:auto 1fr auto;gap:2px 10px;align-items:center;padding:8px 12px;font-size:12px;border-bottom:1px solid var(--line)}.pn li button:hover{background:var(--pv)}.pn li i{width:8px;height:8px;border-radius:50%;background:#2b59d6;grid-row:1/3}.pn li.r i{background:transparent}.pn li b{font-size:12.5px}.pn li.r b{font-weight:500;color:#555}.pn li span{color:var(--muted)}.pn li time{grid-row:1/3;grid-column:3;color:var(--muted);font-size:11px}
.mini{height:30px;padding:0 14px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:12px;font-weight:600;cursor:pointer}.mini:disabled{opacity:.4;cursor:default}@media (prefers-reduced-motion:reduce){.pn,.bl b.pop{animation:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const D=[['Maya commented','on “Onboarding flow”','2m'],['Build finished','Deploy to production','1h'],['New follower','Jon started following you','3h'],['Weekly report','Your summary is ready','1d']];let rd=[0,0,0,1];
const bl=document.getElementById('bl'),pn=document.getElementById('pn'),ls=document.getElementById('ls'),bg=document.getElementById('bg'),ma=document.getElementById('ma');
function draw(){ls.innerHTML=D.map((d,i)=>'<li class="'+(rd[i]?'r':'')+'"><button type="button" data-i="'+i+'"><i></i><b>'+d[0]+'</b><time>'+d[2]+'</time><span>'+d[1]+'</span></button></li>').join('');const n=rd.filter(x=>!x).length;bg.textContent=n||'';bg.classList.remove('pop');void bg.offsetWidth;if(n)bg.classList.add('pop');bl.setAttribute('aria-label','Notifications, '+n+' unread');ma.disabled=!n;}
ls.addEventListener('click',e=>{const b=e.target.closest('button');if(b){rd[+b.dataset.i]=1;draw();}});
function open(v){pn.hidden=!v;bl.setAttribute('aria-expanded',String(v));}
bl.addEventListener('click',()=>open(pn.hidden));ma.addEventListener('click',()=>{rd=rd.map(()=>1);draw();});document.getElementById('rs').addEventListener('click',()=>{rd=[0,0,0,1];draw();});
document.addEventListener('keydown',e=>{if(e.key==='Escape'&&!pn.hidden){open(false);bl.focus();}});draw();open(true);One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Notification Inbox List — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tb{display:flex;justify-content:flex-end}.bl{position:relative;width:38px;height:38px;border-radius:50%;display:grid;place-items:center;border:1px solid var(--line);background:var(--surface)}.bl b{position:absolute;right:-4px;top:-4px;min-width:18px;height:18px;border-radius:99px;background:#e5484d;color:#fff;font-size:11px;display:grid;place-items:center;padding:0 4px}.bl b:empty{display:none}.bl b.pop{animation:pp .25s}
@keyframes pp{50%{transform:scale(1.3)}}
.pn{border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:0 10px 24px rgba(0,0,0,.12);overflow:hidden;animation:in .15s}.pn[hidden]{display:none}@keyframes in{from{opacity:0;transform:translateY(-6px)}}
.ph{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-bottom:1px solid var(--line);font-size:13px}.lk{font-size:12px;color:#2b59d6;font-weight:600}.lk:disabled{color:var(--muted);cursor:default}
.pn ul{list-style:none}.pn li button{width:100%;text-align:left;display:grid;grid-template-columns:auto 1fr auto;gap:2px 10px;align-items:center;padding:8px 12px;font-size:12px;border-bottom:1px solid var(--line)}.pn li button:hover{background:var(--pv)}.pn li i{width:8px;height:8px;border-radius:50%;background:#2b59d6;grid-row:1/3}.pn li.r i{background:transparent}.pn li b{font-size:12.5px}.pn li.r b{font-weight:500;color:#555}.pn li span{color:var(--muted)}.pn li time{grid-row:1/3;grid-column:3;color:var(--muted);font-size:11px}
.mini{height:30px;padding:0 14px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:12px;font-weight:600;cursor:pointer}.mini:disabled{opacity:.4;cursor:default}@media (prefers-reduced-motion:reduce){.pn,.bl b.pop{animation:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="tb"><button class="mini" id="rs" type="button">Reset demo</button><button class="bl" id="bl" type="button" aria-haspopup="true" aria-expanded="false"><svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M6 17V11a6 6 0 0 1 12 0v6l2 2H4z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M10 21a2 2 0 0 0 4 0" fill="none" stroke="currentColor" stroke-width="2"/></svg><b id="bg"></b></button></div><div class="pn" id="pn" hidden><div class="ph"><b>Notifications</b><button class="lk" id="ma" type="button">Mark all read</button></div><ul id="ls"></ul></div><button class="mini" id="rs" type="button">Reset demo</button></div>
</div>
<script>
const D=[['Maya commented','on “Onboarding flow”','2m'],['Build finished','Deploy to production','1h'],['New follower','Jon started following you','3h'],['Weekly report','Your summary is ready','1d']];let rd=[0,0,0,1];
const bl=document.getElementById('bl'),pn=document.getElementById('pn'),ls=document.getElementById('ls'),bg=document.getElementById('bg'),ma=document.getElementById('ma');
function draw(){ls.innerHTML=D.map((d,i)=>'<li class="'+(rd[i]?'r':'')+'"><button type="button" data-i="'+i+'"><i></i><b>'+d[0]+'</b><time>'+d[2]+'</time><span>'+d[1]+'</span></button></li>').join('');const n=rd.filter(x=>!x).length;bg.textContent=n||'';bg.classList.remove('pop');void bg.offsetWidth;if(n)bg.classList.add('pop');bl.setAttribute('aria-label','Notifications, '+n+' unread');ma.disabled=!n;}
ls.addEventListener('click',e=>{const b=e.target.closest('button');if(b){rd[+b.dataset.i]=1;draw();}});
function open(v){pn.hidden=!v;bl.setAttribute('aria-expanded',String(v));}
bl.addEventListener('click',()=>open(pn.hidden));ma.addEventListener('click',()=>{rd=rd.map(()=>1);draw();});document.getElementById('rs').addEventListener('click',()=>{rd=[0,0,0,1];draw();});
document.addEventListener('keydown',e=>{if(e.key==='Escape'&&!pn.hidden){open(false);bl.focus();}});draw();open(true);
</script>
</body></html>