spannotification-dotbeginner

Notification Dot

A small red notification dot badge overlaying an icon to indicate unread items.

Preview
<div class="flex gap-6">
  <button class="relative">
    <svg class="w-6 h-6 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"></path></svg>
    <span class="absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full border-2 border-white"></span>
  </button>
  <button class="relative">
    <svg class="w-6 h-6 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
    <span class="absolute -top-2 -right-3 min-w-[20px] h-5 bg-red-500 text-white text-xs font-bold rounded-full flex items-center justify-center px-1">3</span>
  </button>
</div>

Color Breakdown

Dot

bg-red-500

#ef4444

Dot Border

border-white

#ffffff

Count Text

text-white

#ffffff

Icon

text-gray-600

#4b5563

Dark Mode Variant

Add these Tailwind classes for a dark mode adaptation of this recipe.

dark:border-gray-900 dark:text-gray-300

Use Cases

Notification bell iconsMessage countsCart item badges

Browser Support

All modern browsers.

Related Recipes

Build Your Own Color Recipe

Use our Tailwind CSS tools to experiment with colors, gradients, and component styles.

Explore Tools

Frequently Asked Questions

How do I position the dot on different-sized icons?
Adjust the -top and -right values. For larger icons use -top-1.5 -right-1.5, for smaller icons use -top-0.5 -right-0.5.