Skip to content

Destructive Confirm Alert

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

Toasts & AlertsHTMLCSSany framework

Copy into your project

HTML
<div class="nuda-ta2-confirm" role="alert" aria-live="assertive">
  <div class="nuda-ta2-confirm__row">
    <span class="nuda-ta2-confirm__icon" aria-hidden="true">&#9888;</span>
    <div class="nuda-ta2-confirm__body">
      <p class="nuda-ta2-confirm__title">Delete 3 files?</p>
      <p class="nuda-ta2-confirm__desc">This action can&rsquo;t be undone once confirmed.</p>
    </div>
  </div>
  <div class="nuda-ta2-confirm__actions">
    <button class="nuda-ta2-confirm__btn nuda-ta2-confirm__btn--cancel">Cancel</button>
    <button class="nuda-ta2-confirm__btn nuda-ta2-confirm__btn--danger">Delete</button>
  </div>
  <div class="nuda-ta2-confirm__track" aria-hidden="true">
    <div class="nuda-ta2-confirm__bar"></div>
  </div>
</div>
CSS
.nuda-ta2-confirm {
  --r: #ff5e7a;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  background: #161616;
  border: 1px solid rgba(255,94,122,.3);
  border-radius: 12px;
  padding: .85rem .9rem .7rem;
  min-width: 270px;
  max-width: 320px;
  overflow: hidden;
  position: relative;
  animation: _nuda-ta2confirmin .35s ease-out both;
}

.nuda-ta2-confirm__row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}

.nuda-ta2-confirm__icon {
  color: var(--r);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.nuda-ta2-confirm__title {
  color: #fafafa;
  font-size: .85rem;
  font-weight: 700;
  margin: 0;
}

.nuda-ta2-confirm__desc {
  color: #9a9a9a;
  font-size: .74rem;
  line-height: 1.4;
  margin: .25rem 0 0;
}

.nuda-ta2-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.nuda-ta2-confirm__btn {
  min-height: 36px;
  padding: 0 .8rem;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: #cfcfcf;
  font-size: .74rem;
  font-weight: 600;
  cursor: pointer;
}

.nuda-ta2-confirm__btn:hover {
  background: rgba(255,255,255,.06);
}

.nuda-ta2-confirm__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.nuda-ta2-confirm__btn--danger {
  background: var(--r);
  border-color: var(--r);
  color: #1a0a0d;
}

.nuda-ta2-confirm__btn--danger:hover {
  background: #ff7d92;
}

.nuda-ta2-confirm__track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
}

.nuda-ta2-confirm__bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  background: var(--r);
  animation: _nuda-ta2confirmcountdown 6s linear forwards;
}

@keyframes _nuda-ta2confirmin {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes _nuda-ta2confirmcountdown {
  to {
    transform: scaleX(0);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-ta2-confirm {
    animation: none;
  }
  .nuda-ta2-confirm__bar {
    animation: none;
    transform: scaleX(.4);
  }
}

How to use Destructive Confirm Alert

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