Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Badge examples · Outline

Circular Badge with Count (Outline) for React

A circular outline badge showing a number for updates and other non-urgent counts.

Framework
UI library

A number in a thin circle informs without alarming. This React badge uses the Badge component's outline variant with pill and size="lg": a fully rounded, bordered badge whose minimum width equals its height, so a single digit makes a circle. Use it for unread counts, pending items or available updates: numbers that inform rather than alert.

Preview

Preview width
3

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How does the number become a circle in React?

pill sets rounded-full, and size="lg" adds h-6.5 and min-w-6.5, so one digit has a matching height and minimum width. A longer number widens past that minimum.

What does variant outline change on the circle?

variant="outline" sets a border-border edge and text-foreground, and leaves the background unset. The circle classes in this file stay as they are.

How do I make the number make sense to a screen reader?

A bare number does not say what is counted. Put the noun in the badge, such as 3 unread, or set aria-label to 3 unread messages.

How do I make the circle smaller?

size also takes sm, which sets h-5 and min-w-5. Keep pill so the ends stay round.

Is the count a button?

No. The count is the text of a span. Place the badge next to the thing it counts. A control that does something is a Button.

Where do I put the number?

The digits are the badge text, 3 in this demo. Replace that text with the count you want to show.