Mark All Read with Undo
A copy-paste notification center component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Notification CenterHTMLCSSany framework
12 marked as read
Copy into your project
HTML
<div class="nuda-nc2-mark-read-undo" role="status" aria-live="polite">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span class="nuda-nc2-mark-read-undo__text">12 marked as read</span>
<button type="button" class="nuda-nc2-mark-read-undo__undo">Undo</button>
<span class="nuda-nc2-mark-read-undo__timer" aria-hidden="true"></span>
</div>CSS
.nuda-nc2-mark-read-undo {
position: relative;
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
background: #131316;
border: 1px solid rgba(255,255,255,.1);
border-radius: 10px;
color: #fafafa;
width: 100%;
max-width: 290px;
overflow: hidden;
animation: _nuda-nc2mark-read-undo-in .35s cubic-bezier(.16,1,.3,1) both;
}
.nuda-nc2-mark-read-undo > svg {
width: 15px;
height: 15px;
color: #6ee7b7;
flex-shrink: 0;
}
.nuda-nc2-mark-read-undo__text {
flex: 1;
font-size: 12px;
color: #cfcfcf;
}
.nuda-nc2-mark-read-undo__undo {
background: transparent;
border: 0;
color: #e4ff54;
font-size: 11px;
font-weight: 700;
cursor: pointer;
padding: 6px 8px;
min-height: 32px;
border-radius: 6px;
transition: background .2s;
}
.nuda-nc2-mark-read-undo__undo:hover {
background: rgba(228,255,84,.1);
}
.nuda-nc2-mark-read-undo__undo:focus-visible {
outline: 2px solid #e4ff54;
outline-offset: 2px;
}
.nuda-nc2-mark-read-undo__timer {
position: absolute;
left: 0;
bottom: 0;
height: 2px;
width: 100%;
background: #e4ff54;
transform-origin: right;
animation: _nuda-nc2mark-read-undo-shrink 5s linear forwards;
}
@keyframes _nuda-nc2mark-read-undo-in {
from {
opacity: 0;
transform: translateY(-6px);
}
to {
opacity: 1;
transform: none;
}
}
@keyframes _nuda-nc2mark-read-undo-shrink {
to {
transform: scaleX(0);
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-nc2-mark-read-undo {
animation: none;
}
.nuda-nc2-mark-read-undo__timer {
animation: none;
transform: none;
opacity: .4;
}
}
How to use Mark All Read with Undo
Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.
Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.