Badge
Two kinds. Badge labels a status or category next to content. NotificationBadge sits on the corner of an icon or avatar to say something new is waiting.
Install
npx shadcn@latest add @nelumbo/badgeBadge
Black and white for neutral labels; tonal palette colors when the badge carries meaning. shadcn's default, secondary, outline and destructive work as is.
Dots and icons
dot adds a status dot in the badge's accent; icon adds a leading Material Symbol. size="sm" is 20px, for table rows and dense lists.
In a heading
Next to a title, the badge lines up with the text.
Spring campaign
Billing
NotificationBadge
A dot for something new, or a count that caps at max (999+ by default). It springs in and out. placement says what it sits on: a bare icon, an icon button, or an avatar. Screen readers don't see it, so put the count in the control's name.
dot
count
max
icon button
icon button, dot
avatar
avatar, dot
Usage
import { Badge, NotificationBadge } from "@/components/ui/badge"<Badge>New</Badge><Badge variant="success" dot>Live</Badge><Badge variant="secondary" icon="schedule" size="sm">Due Friday</Badge><NotificationBadge count={unread} placement="button"> <IconButton icon="notifications" label={`Notifications, ${unread} new`} /></NotificationBadge>Props
| Prop | Type | Default | Notes |
|---|---|---|---|
Badge variant | "default" | "secondary" | "outline" | "brand" | "success" | "warning" | "destructive" | "info" | "default" | |
Badge size | "default" | "sm" | "default" | 24px or 20px |
Badge dot | boolean | false | Leading status dot |
Badge icon | IconName | Leading Material Symbol | |
Badge asChild | boolean | false | Render as your link |
NotificationBadge count | number | Leave out for a dot; 0 hides it | |
NotificationBadge max | number | 999 | Above it, shows "999+" |
NotificationBadge placement | "icon" | "button" | "avatar" | "icon" | What it sits on |
NotificationBadge invisible | boolean | false | Hide it (it springs away) |