Variants
A marker stamp, a highlighter swipe, a red-hatched pill, a circled word, and two that only show up when they are links.
A small mark that sits next to a word: a marker stamp, a highlighter swipe, a red-hatched warning, a circled word, and a count that can be written as tally marks. Same variants and asChild as shadcn.
npx shadcn@latest add @wobko/badgeFirst time here? Add the registry to components.json first. How to install
A marker stamp, a highlighter swipe, a red-hatched pill, a circled word, and two that only show up when they are links.
Three heights, an icon slot in front of the label (the icon keeps its own 14 px drawing), and the stationery accents for the marker fill.
A number in tabular figures that stops at 99+, and the same number written the way a person keeps score: four uprights and a slash. Screen readers get the digits either way.
asChild hands the badge to your own element. Hover a link badge: the filled ones lift a drop-line, the outline gets a highlighter wash, ghost swipes and link underlines. Tab to it for the felt ring.
Badges doing real work in a card: a status next to the title, the kind of each change in front of its line, and a tally of how many are left to read.
A span (or, with asChild, the element you hand it) with a hand-drawn layer behind its label. The label is DOM text in the hand font; the drawing is measured from the element and centered on it. Unlike shadcn's it has no overflow-hidden (the drawing bleeds a few px outside the box, and clipping would cut it), so to truncate a long label put a truncating span inside it. It draws no aria-invalid state. Each badge is one small ink host (about 2 to 6 KB of svg, drawn at 0.3 to 0.8 ms): fine for a screenful, and for a status column of a few hundred rows if you page it; the ghost variant draws nothing until it is a hovered link.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | "default" | default = a terracotta marker blot that misses a felt-tip pill; secondary = one highlighter swipe; destructive = red-pencil hatch in a red pill (a pattern, not only a hue); outline = the label circled once; ghost and link draw nothing until they are hovered as links. |
| size | "sm" | "default" | "lg" | "default" | 20, 24 and 28 px high. sm sets its label at 13 px: keep it for dense tables, use default anywhere a badge stands alone. |
| tone | "marker" | "hi" | "tangerine" | "lemon" | "grass" | "teal" | "sky" | "bubblegum" | "marker" | The stationery accent of the default variant's fill. Tomato and grape are left out on purpose: ink on them is 3.95:1. |
| count | number | - | A number shown when there are no children, in tabular figures and a min-width, so a column of counts lines up. |
| max | number | 99 | Largest count written in digits; a bigger one shows as `${max}+`. |
| tally | boolean | false | Write `count` (1 to 20) as tally marks instead of digits: four uprights and a slash per five. The number stays in the DOM, visually hidden, so screen readers still read it. |
| asChild | boolean | false | Render the child element (a link, a button) with the badge's classes and drawing, drawn inside it (Radix Slot). A badge that is a link or has an onClick also gets a hover layer. count and tally are ignored. |
| seed | string | number | - | Pins the hand: the same seed always draws the same badge, also across remounts. Default: derived from useId(). |
The cva function behind Badge, for styling another element like a badge. Layout and typography classes only: the drawing comes from Badge.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | BadgeVariant | "default" | Same values as Badge. |
| size | BadgeSize | "default" | Same values as Badge. |
| className | string | - | Merged last. |
The files the CLI copies into your project.
Loading the source