Badge

General-purpose badge in default, secondary, outline, destructive, success and warning (soft or solid), three sizes, with an optional pulsing status dot or icon, removable filter chips whose x plays an exit before onRemove while siblings glide into the gap, and a count mode whose digits roll in the direction of change and cap at 99+ (complements AnimatedBadge, which animates status transitions).

Preview

Badge preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/badge
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

variant?
"secondary" | "outline" | "default" | "success" | "destructive" | "warning"
—
tone?
"solid" | "soft"

Status variants only (destructive/success/warning). Default "soft".

—
size?
"sm" | "md" | "lg"
—
dot?
boolean | "pulse"

Leading status dot in the text color; `"pulse"` adds a radiating ring.

—
icon?
ReactNode

Leading icon (sized to the badge). Ignored when `dot` is set.

—
onRemove?
(() => void)

Makes the badge removable: an × button plays the exit, then calls this. Focus moves to the neighbouring chip's × when the removal came from it.

—
removeLabel?
string

Accessible name of the × button. Default `Remove <text>`.

—
count?
number

Count mode: renders a compact number that rolls up or down as it changes and bumps when it rises. Hidden at 0 unless `showZero`.

—
max?
number

Counts above this read "max+". Default 99.

—
showZero?
boolean
—
countLabel?
((count: number) => string)

Spoken label for count mode, e.g. `(n) => \`${n} unread\``.

—
className?
string
—

Updated