Skip to content

Notification Badge

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

IndicatorsHTMLCSSany framework
3

Copy into your project

HTML
<div style="position: relative; display: inline-flex;">
  <!-- Your icon or element here -->
  <button class="nuda-icon-btn" aria-label="Notifications">
    🔔
  </button>
  <span class="nuda-notif-badge" aria-label="3 notifications">3</span>
</div>
CSS
/* Notification Badge
   Bouncing number badge for notifications.
   Customize: --badge-bg, --badge-fg */

.nuda-notif-badge {
  --badge-bg: #ef4444;
  --badge-fg: #fff;
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border-radius: 10px;
  animation: nuda-notif-bounce 0.4s cubic-bezier(0.36, 1.4, 0.65, 1) both;
  will-change: transform;
}

@keyframes nuda-notif-bounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

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

How to use Notification Badge

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 indicators components

← Browse all NudaUI components