Skip to content

Confirm Dialog

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-confirm" role="alertdialog" aria-modal="true" aria-labelledby="confirm-title">
  <div class="nuda-mdx-confirm__icon">
    <svg width="22" height="22" viewBox="0 0 24 24" fill="none">
      <circle cx="12" cy="12" r="10" stroke="#e4ff54" stroke-width="1.5"/>
      <path d="M12 7v5" stroke="#e4ff54" stroke-width="2" stroke-linecap="round"/>
      <circle cx="12" cy="16" r="1" fill="#e4ff54"/>
    </svg>
  </div>
  <p class="nuda-mdx-confirm__title" id="confirm-title">Delete item?</p>
  <p class="nuda-mdx-confirm__body">This action cannot be undone.</p>
  <div class="nuda-mdx-confirm__actions">
    <button class="nuda-mdx-confirm__btn nuda-mdx-confirm__btn--cancel">Cancel</button>
    <button class="nuda-mdx-confirm__btn nuda-mdx-confirm__btn--ok">Delete</button>
  </div>
</div>
CSS
.nuda-mdx-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  background: #141414;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 1.1rem 1rem;
  max-width: 220px;
  margin: auto;
  animation: _nuda-mdxConfirmIn .35s cubic-bezier(.16,1,.3,1) both;
}

.nuda-mdx-confirm__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(228,255,84,.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nuda-mdx-confirm__title {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  color: #fafafa;
  text-align: center;
}

.nuda-mdx-confirm__body {
  margin: 0;
  font-size: .68rem;
  color: #777;
  text-align: center;
}

.nuda-mdx-confirm__actions {
  display: flex;
  gap: .5rem;
  margin-top: .2rem;
}

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

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

.nuda-mdx-confirm__btn--cancel {
  background: rgba(255,255,255,.07);
  color: #cfcfcf;
}

.nuda-mdx-confirm__btn--ok {
  background: #ff6b6b;
  color: #fff;
}

@keyframes _nuda-mdxConfirmIn {
  from {
    opacity: 0;
    transform: scale(.92) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

How to use Confirm Dialog

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