Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Circular Badge with Count (Secondary) for Svelte

A round secondary badge showing the number 3 on a muted fill, for a total that is context rather than an alert.

UI library: Ark UI

The badge is a circle with the number 3 on a muted fill. One digit keeps it round. Nothing else is on screen.

Use it for drafts, reviews, or any tally that should not pull focus. If people should act on it, use a Button. In Svelte, Ark UI rounds the badge fully.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Badge anatomy: root, icon, text

Usage

<Badge pill size="lg" variant="secondary">3</Badge>

FAQ

How does the number become a circle in Svelte?

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 secondary change?

variant="secondary" uses the muted secondary fill and secondary-foreground text. 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.

API Reference

Badge

Sets pill, size="lg" and variant="secondary". The rest is on the Badge page.