Icon Circle Button

Circular icon button with a ping notification dot.

Tailwind CSS
<button aria-label="Notifications" class="relative w-12 h-12 rounded-full bg-white border border-slate-200 shadow-sm flex items-center justify-center text-slate-600 hover:shadow-md hover:-translate-y-0.5 transition-all duration-200">
  <svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2a2 2 0 01-.6 1.4L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/></svg>
  <span class="absolute top-2 right-2 flex h-3 w-3">
    <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"></span>
    <span class="relative inline-flex rounded-full h-3 w-3 bg-red-500"></span>
  </span>
</button>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

Chat, no badge

Clean icon button without the notification dot for quiet actions.

Tailwind CSS

Dark

Dark surface version for navbars and dark mode interfaces.

Tailwind CSS

Count badge

Numbered badge when the exact unread count matters more than a dot.

Tailwind CSS

About this icon circle button

Circular icon buttons are the compact action: a notification bell, a settings gear, a close X. This one adds the pinging red dot, the universal unread indicator. It is the header action pattern from every dashboard and social app.

The notification dot uses two spans: an animate-ping halo that expands and fades, over a solid red core. The ping draws the eye without being as aggressive as a bouncing badge. The button itself lifts on hover for tactile feedback.

Always include an aria-label on icon buttons since there is no text. The badge count (or dot) should update dynamically; a static dot on a button with no notifications trains users to ignore it.

App headers are ruthless about space: search, notifications, settings, and the avatar must fit in one thin strip. Text buttons would overflow it, so each action compresses to a 48px circle. But compression creates a new problem: a silent bell icon cannot tell you that something needs attention. The pinging dot is the fix, a tiny broadcast tower on top of the icon that says look here without a banner or a modal.

The button is w-12 h-12 rounded-full with the SVG icon centered by flex. The badge is an absolute top-2 right-2 flex h-3 w-3 wrapper holding two spans: an animate-ping bg-red-400 opacity-75 halo that expands and fades on loop, over a solid bg-red-500 core that persists between pulses. On hover the button lifts with hover:-translate-y-0.5 and deepens to hover:shadow-md, giving the press a tactile answer.

When the count matters more than the alert, swap the dot for a numbered badge (min-w-5 px-1 text-[10px]) and let it grow with the digits. Recolor the ping by severity: red for urgent, sky for informational, amber for warnings. On dark headers, switch the button to bg-slate-800 with a subtle border and light icons, keeping the badge colors unchanged so their meaning stays constant.

The mistake is forgetting position: relative on the button. The badge is absolutely positioned, and without a positioned ancestor it anchors to the nearest positioned container up the tree, which is often the page itself. The dot then floats in some random corner while the button sits bare. Since Tailwind's absolute utilities assume you handled the ancestor, always pair an absolute badge with relative on the button.

Where to use it

  • ✓ Notification bells
  • ✓ Settings shortcuts
  • ✓ Dashboard header actions
  • ✓ Social app toolbars

Customization tips

Replace the dot with a count badge for numbered notifications. Change the ping color to match severity: red for urgent, blue for informational. Size with w-10/w-12/w-14.

Design notes

When to use

Use it for compact header actions: notification bells, settings gears, and close buttons in dashboards and social apps. The pinging red dot is the universal unread indicator, so it fits anywhere you show alert counts. It stays small while carrying a lot of meaning.

What to avoid

Do not leave a static notification dot on a button with zero notifications. A dot that never clears trains users to ignore it, and then real alerts get missed. Do not use it without an aria-label, since there is no text to announce.

Accessibility

Always include an aria-label naming the action, like Notifications. The ping animation should pause under prefers-reduced-motion, and the dot color alone should not be the only signal, pair it with a count or label.

Frequently asked questions

How do I add a notification dot to a button?

Absolutely position a small dot at the button corner. Layer an animate-ping span under a solid span for the pulsing halo effect.

Icon button vs text button?

Icon buttons save space and suit universal actions (close, settings, notifications). Use text buttons when the action needs explanation or is primary.

Do icon buttons need labels?

Yes, via aria-label for screen readers. Optionally add a tooltip on hover for sighted users who may not recognize the icon.

How do I position a notification badge on the top right of an icon button?

Make the button relative, then place the badge absolute with top-0 right-0 and add translate-x-1/2 -translate-y-1/2 so it centers exactly on the corner. This keeps the badge pinned to the corner no matter what size the button is.

What aria-label should I put on an icon-only button?

Describe the action, not the icon. A bell icon that opens notifications gets aria-label='Notifications', not 'Bell icon'. Screen readers announce the label, so write what the button does. If it shows a count, include it, like 'Notifications, 3 unread'.

What size should an icon-only button be for touch?

Aim for at least 44 by 44 pixels, the recommended minimum touch target. A 24px icon inside a 44px circle works well. If your design uses smaller buttons on desktop, keep the visual small but expand the clickable area with a pseudo-element.

Customize it with our tools