Skip to content
nexubDesign System
v12.7.0

Components · Labels & Badges

Badge

StableAdded v0.0.1

Small status indicator or label. Communicates state, category, or count.

import { Badge } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Labelling a status, category, or tag on an item

  • Showing a count or numeric indicator alongside an element

  • Highlighting new, featured, or updated content

  • Communicating a stage in a workflow (draft, published, archived)

Use something else for
  • Interactive filtering — use FilterChip or Chip instead

  • Long text labels that exceed 2–3 words

  • Critical alerts requiring user action — use Alert or Toast

  • Replacing a button — badges are non-interactive by design

Playground

Playground

Live
Badge
TSX
<Badge variant="soft" tone="neutral">Badge</Badge>

Examples

Tones

ActiveErrorWarningInfoDraft

Variants

SolidSoftOutline

With leading dot

OnlineOfflineAway

Agent badge

AgentBadge (12.2, beta) labels an AI agent in a chat header ("AI on your own key", "Buttons only"): a soft Badge with a leading sparkle. Pair it with `AgentAvatar`.

AI on your own keyButtons only

States

  • Active
    default
  • Active
    size="sm"
  • Active
    size="md"
  • Active
    size="lg"
  • Active
    variant="solid"
  • Active
    variant="outline"
  • Active
    variant="soft"
  • Active
    tone="neutral"
  • Active
    tone="info"
  • Active
    tone="success"
  • Active
    tone="warning"
  • Active
    tone="danger"
  • Active
    tone="leap"
  • Active
    tone="bookub"
  • Active
    tone="payub"

Variant matrix

Variants × tone / variant5 × 3
tone ↓ / variant →solidsoftoutline
success
Badge
Badge
Badge
danger
Badge
Badge
Badge
warning
Badge
Badge
Badge
info
Badge
Badge
Badge
neutral
Badge
Badge
Badge

Props

Props
PropTypeDefaultDescription
variant'solid' | 'outline' | 'soft''solid'Visual fill style.
tone'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'leap' | 'bookub' | 'payub' | 'founderub''neutral'Semantic color tone.
size'sm' | 'md' | 'lg''md'Badge size.
leadingIconReact.ReactNode—Icon or dot rendered before the label.
AgentBadge iconReact.ReactNode—AgentBadge (12.2, beta): the leading icon. Default: a sparkle. AgentBadge is always variant="soft" and takes Badge's tone, category and size.
category'accent' | 'blue' | 'amber' | 'emerald' | 'pink' | 'violet' | 'cyan' | 'red' | 'lime'—10.3: a category colour for tags and labels (e.g. one per project or team). Wins over tone. It carries no meaning by itself: status still uses tone.
countnumber—A number to show. Above max it reads "99+"; screen readers get the full number.
dotboolean—A status dot. Before the label when there is one; on its own (no children or count) it is just the dot: give it an aria-label, or it's decorative.
maxnumber99

Design tokens

Badge reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Badge below it, and leave the roles other components share alone. See the three token tiers.

Badge design tokens
TokenAliasesNotes
--badge-radius--shape-control—
CSS
/* One area of your app */
.checkout {
  --badge-radius: var(--shape-field);
}

Accessibility

ARIA roles

status (when conveying live state)

Keyboard

  • —

    Badges are non-interactive and have no keyboard handlers.

Focus

  • Skipped in tab order. Decorative — never trap focus on a Badge.

Screen reader

  • Reads as inline text. For live status changes, wrap in an element with `role="status"` and `aria-live="polite"`.

Notes

  • For interactive equivalents (filtering, dismissing) reach for `Chip` or `FilterChip`.