Badge
A short label for a status or a category. It uses a soft fill, or an outline when it should stay quiet. Its fill is never a solid hue; a solid appears only as the small decorative dot. Solid fills with text-on-<hue> are for Avatar.
Preview
Usage
When to use
- Show the state of an item next to it: Failed, Ready, Expiring.
- Tag an item with a category the user reads but doesn't act on: Design, Beta.
When not to use
- Anything clickable or toggleable. Use Button.
- A picked value the user can take out, such as an active filter. Use Token with a remove button.
- Naming a design token or another machine value. Use Token.
- Sentences or long labels. Keep a badge label short: Beta, Failed, New.
Platform support
What each platform has, from the spec. A selected platform is highlighted.
| Name | Web | iOS | Android | Note |
|---|---|---|---|---|
| variant | Yes | Yes | Yes | |
| size | Yes | Yes | Yes | |
| dot | Yes | Yes | Yes | |
| ring | Yes | Yes | Yes | |
| accessibilityLabel | No | Yes | Yes | Only on iOS, Android. |
Variants
variant
default is a neutral gray label. accent uses the muted accent. outline has no fill, only a thin border. destructive, success, warning and info show a status. red, orange, yellow, green, teal, blue, purple and pink mark a category. Every filled variant pairs the soft background with its matching text color; the fill is never the solid (the dot is the only solid).
size
md is 24px tall. sm is 20px with tighter padding, like Token, for dense tables and counts inside a tab.
Examples
Default
With icon
Info
Status dot
Small
Dot only
Do and don't
Do
- Use the status variants (destructive, success, warning, info) for state, and hues for categories.
- Keep labels short: Beta, Failed, New.
- Show at most one status badge per row or card.
- Put the icon (12px) before the label.
- Use outline for a quiet neutral label next to filled badges.
- Use a dot-only badge for a notification dot on an icon, named with aria-label, and add ring when it sits on an icon or a photo.
Don't
- Don't make a badge clickable.
- Don't use Badge for filter chips or removable tags. Anything that toggles or has a remove action is a Button.
- Don't put text or icons on a hue solid (bg-red). Solids are for dots and charts.
- Don't use the danger solid with text-on-danger for a badge; destructive is the soft pair.
- Don't restyle colors through className. Pick a variant. If none fits, open an issue instead of overriding it.
Props
| Name | Type | Values | Default | Description |
|---|---|---|---|---|
| variant | enum | default | accent | outline | destructive | success | warning | info | red | orange | yellow | green | teal | blue | purple | pink | default | default is a neutral gray label. accent uses the muted accent. outline has no fill, only a thin border. destructive, success, warning and info show a status. red, orange, yellow, green, teal, blue, purple and pink mark a category. Every filled variant pairs the soft background with its matching text color; the fill is never the solid (the dot is the only solid). |
| size | enum | sm | md | md | md is 24px tall. sm is 20px with tighter padding, like Token, for dense tables and counts inside a tab. |
| dot | boolean | - | false | A 6px status dot before the label, on the solid of the badge's hue (bg-danger for destructive, bg-<hue> for a hue). The only solid in a badge. Decorative: the label still carries the meaning. With no label the badge is the dot alone, with no pill: name it with aria-label (accessibilityLabel on native), for example a notification dot on an icon. |
| ring | boolean | - | false | Dot-only badge: adds a spacing-2xs ring in the page color around the dot, so it reads on an icon or any surface. Ignored when the badge has a label. |
| accessibilityLabel | string | - | - | The name VoiceOver and TalkBack read for a dot-only badge, such as New messages. Required by the dot-only form, as aria-label is what names it on the web. Only on iOS, Android. |
Slots
| Name | Required | Description |
|---|---|---|
| label | yes | Short label, sentence case or a single status word. Leave it out only with dot, for a dot-only badge. |
| icon | no | Optional leading icon. |
Anatomy
| Part | Description |
|---|---|
| root | The badge surface: size-inline-md (24px) tall, size-inline-sm (20px) for size sm, soft fill, radius-element, compact type. |
| icon | Optional Tabler icon before the label, 12px. |
| dot | Optional status dot, data-slot badge-dot, aria-hidden. A circle of spacing-2xs * 3 (6px) on the solid of the badge hue; the only solid in a badge. There is no size token for it, so the size is an expression. With dot and no label the dot is the whole badge: no pill, padding or height. |
| ring | Dot-only badge with ring: a spacing-2xs ring in color-background-page around the dot (on the web the --ring-offset-color AvatarStack uses, the page by default), so the dot reads on an icon, a photo or any surface. |
Accessibility
Role: generic
- Badge is not interactive. Don't make it a link or button; put the action on the row or card instead.
- Color is not the only cue: keep a short text label (Failed, not only a red dot).
- A dot-only badge (dot with no label) is named by aria-label and then has role="img"; on iOS and Android the dot-only form requires accessibilityLabel. Without aria-label on the web it is aria-hidden, for a parent that names it (BottomNavItem names its dot through dotLabel).
- Root is a plain span with no role, so a badge is never a live region by default. If a badge's text changes and must be announced (a build going from Running to Failed), add role="status" at the call site.
Install
npx werewolf-ui add badgeRun npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.