Swipe to Dismiss
A copy-paste notification center component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Notification CenterHTMLCSSany framework
Dismiss
New review on Product A
Copy into your project
HTML
<div class="nuda-swdis">
<div class="nuda-swdis__bg">Dismiss</div>
<div class="nuda-swdis__card">New review on Product A</div>
</div>CSS
.nuda-swdis {
position: relative;
width: 100%;
max-width: 260px;
height: 46px;
border-radius: 10px;
overflow: hidden;
}
.nuda-swdis__bg {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 16px;
background: #ff5e7a;
color: #fafafa;
font-size: 11px;
font-weight: 600;
}
.nuda-swdis__card {
position: relative;
display: flex;
align-items: center;
padding: 0 14px;
height: 100%;
background: #111114;
border: 1px solid rgba(255,255,255,.08);
border-radius: 10px;
color: #fafafa;
font-size: 12px;
cursor: grab;
animation: _swdisDemo 4s ease-in-out infinite;
}
@keyframes _swdisDemo {
0%,100% {
transform: translateX(0);
}
40% {
transform: translateX(-40%);
}
60% {
transform: translateX(-40%);
}
80% {
transform: translateX(0);
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-swdis__card {
animation: none;
transform: none;
}
}
How to use Swipe to Dismiss
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.