Notification Center
A notification list where items dismiss and show an empty state.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div class="card border-0 shadow-sm" style="max-width:340px"><div class="card-header bg-white d-flex justify-content-between align-items-center"><b class="small">Notifications</b><button class="btn btn-sm btn-link text-decoration-none p-0" id="ncClear">Clear all</button></div>
<div class="list-group list-group-flush" id="ncList">
<div class="list-group-item d-flex gap-2 py-2"><span>✉️</span><div class="small flex-fill">New message<div class="text-secondary" style="font-size:.7rem">2m</div></div><button class="btn-close btn-sm" data-nc></button></div>
<div class="list-group-item d-flex gap-2 py-2"><span>💰</span><div class="small flex-fill">Payment received<div class="text-secondary" style="font-size:.7rem">1h</div></div><button class="btn-close btn-sm" data-nc></button></div>
</div>
<div class="card-body text-center text-secondary small" id="ncEmpty" style="display:none">All caught up 🎉</div></div>var list=document.getElementById('ncList'),empty=document.getElementById('ncEmpty');
function check(){if(!list.querySelector('.list-group-item')){list.style.display='none';empty.style.display='block'}}
function bind(b){b.onclick=function(){b.closest('.list-group-item').remove();check()}}
list.querySelectorAll('[data-nc]').forEach(bind);
document.getElementById('ncClear').onclick=function(){list.innerHTML='';check()};Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.