Skip to content

Alert Dialog Danger

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

Modals & OverlaysHTMLCSSany framework

Copy into your project

HTML
<div class="nuda-mdx-alertdanger" role="alertdialog" aria-modal="true" aria-labelledby="alert-title" aria-describedby="alert-desc">
  <div class="nuda-mdx-alertdanger__strip"></div>
  <div class="nuda-mdx-alertdanger__inner">
    <div class="nuda-mdx-alertdanger__icon">
      <svg width="20" height="20" viewBox="0 0 24 24" fill="none">
        <path d="M12 2 L22 20 H2 Z" stroke="#ff6b6b" stroke-width="1.6" stroke-linejoin="round"/>
        <path d="M12 9v5" stroke="#ff6b6b" stroke-width="2" stroke-linecap="round"/>
        <circle cx="12" cy="17" r="1" fill="#ff6b6b"/>
      </svg>
    </div>
    <div>
      <p class="nuda-mdx-alertdanger__title" id="alert-title">Permanent deletion</p>
      <p class="nuda-mdx-alertdanger__body" id="alert-desc">All data will be lost. You cannot undo this.</p>
    </div>
  </div>
  <div class="nuda-mdx-alertdanger__actions">
    <button class="nuda-mdx-alertdanger__btn nuda-mdx-alertdanger__btn--ghost">Cancel</button>
    <button class="nuda-mdx-alertdanger__btn nuda-mdx-alertdanger__btn--destroy">Yes, delete all</button>
  </div>
</div>
CSS
.nuda-mdx-alertdanger {
  background: #141414;
  border: 1px solid rgba(255,107,107,.22);
  border-radius: 14px;
  overflow: hidden;
  max-width: 240px;
  margin: auto;
  animation: _nuda-mdxAlertIn .35s ease-out both;
}

.nuda-mdx-alertdanger__strip {
  height: 3px;
  background: linear-gradient(90deg,#ff6b6b,#ff4444);
}

.nuda-mdx-alertdanger__inner {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .8rem .85rem .5rem;
}

.nuda-mdx-alertdanger__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,107,107,.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nuda-mdx-alertdanger__title {
  margin: 0 0 .18rem;
  font-size: .72rem;
  font-weight: 700;
  color: #fafafa;
}

.nuda-mdx-alertdanger__body {
  margin: 0;
  font-size: .62rem;
  color: #777;
  line-height: 1.45;
}

.nuda-mdx-alertdanger__actions {
  display: flex;
  gap: .4rem;
  justify-content: flex-end;
  padding: .55rem .85rem .75rem;
}

.nuda-mdx-alertdanger__btn {
  border: none;
  border-radius: 8px;
  padding: .36rem .7rem;
  font-size: .65rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

.nuda-mdx-alertdanger__btn:hover {
  opacity: .8;
}

.nuda-mdx-alertdanger__btn--ghost {
  background: rgba(255,255,255,.06);
  color: #cfcfcf;
}

.nuda-mdx-alertdanger__btn--destroy {
  background: #ff6b6b;
  color: #fff;
}

@keyframes _nuda-mdxAlertIn {
  from {
    opacity: 0;
    transform: scale(.94) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-mdx-alertdanger {
    animation: none;
  }
}

How to use Alert Dialog Danger

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 modals & overlays components

← Browse all NudaUI components