Skip to content

Undo Toast

A copy-paste toasts & alerts component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Toasts & AlertsHTMLCSSany framework
"Design draft" was deleted

Copy into your project

HTML
<div class="nuda-undotoast">
  <span class="nuda-undotoast__icon">
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
         stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
      <path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6" />
    </svg>
  </span>
  <span class="nuda-undotoast__text">"Design draft" was deleted</span>
  <button class="nuda-undotoast__btn">Undo</button>
  <span class="nuda-undotoast__bar"></span>
</div>
CSS
.nuda-undotoast {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  background: #111114;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  color: #fafafa;
  width: 100%;
  max-width: 280px;
  overflow: hidden;
  animation: _undotIn .5s cubic-bezier(.16,1,.3,1) both;
  box-shadow: 0 14px 36px -10px rgba(0,0,0,.5);
}

.nuda-undotoast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #ff5e7a;
  flex-shrink: 0;
}

.nuda-undotoast__icon svg {
  width: 14px;
  height: 14px;
}

.nuda-undotoast__text {
  flex: 1;
  font-size: 12px;
  color: #a0a0a8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nuda-undotoast__btn {
  padding: 5px 10px;
  background: transparent;
  border: 0;
  color: #e4ff54;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background .2s,color .2s;
}

.nuda-undotoast__btn:hover {
  background: rgba(228,255,84,.1);
  color: #fafafa;
}

.nuda-undotoast__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background: #ff5e7a;
  animation: _undotBar 5s linear forwards;
}

@keyframes _undotIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes _undotBar {
  from {
    width: 100%;
  }
  to {
    width: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-undotoast,.nuda-undotoast__bar {
    animation: none;
  }
  .nuda-undotoast__bar {
    width: 100%;
  }
}

How to use Undo Toast

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.

More toasts & alerts components

← Browse all NudaUI components