[ Data Display ]

Badge

A small label for status, counts and categories. Three styles × six semantic colors, with an optional status dot.

3 examplesDark modeAccessible

Import#

import { Badge } from 'reusify-ui';

When to use#

  • Showing a status ("Active", "Pending", "Failed") next to an item.
  • Tagging categories or small counts.
  • Badges aren't interactive. For clickable filters, use a small Button instead.

Examples#

Variants#

soft (default) is the quietest and works well in tables. solid is for strong emphasis, outline for neutral tags.

SoftSolidOutline
<Badge variant="soft">Soft</Badge>
<Badge variant="solid">Solid</Badge>
<Badge variant="outline">Outline</Badge>

Colors#

color maps to the theme tokens, so badges follow your brand and dark mode automatically.

PrimarySecondarySuccessDangerWarningInfo
PrimarySecondarySuccessDangerWarningInfo
PrimarySecondarySuccessDangerWarningInfo
<Badge color="primary">Primary</Badge>
<Badge color="secondary">Secondary</Badge>
<Badge color="success">Success</Badge>
<Badge color="danger">Danger</Badge>
<Badge color="warning">Warning</Badge>
<Badge color="info">Info</Badge>

Status dot & sizes#

OnlineAwayOfflineNew
<Badge color="success" dot>Online</Badge>
<Badge color="warning" dot>Away</Badge>
<Badge color="secondary" dot>Offline</Badge>
<Badge size="sm" color="info">New</Badge>

Used in designs#

Badge in real layouts: these 6 designs use it. Open one to try it and copy the code.

API reference#

<Badge />

Also accepts every <span> attribute.

variant'soft'
'soft' | 'solid' | 'outline'

Visual style.

color'primary'
'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info'

Semantic color.

size'md'
'sm' | 'md'

Badge size.

dotfalse
boolean

Shows a small status dot before the text.

Accessibility#

  • Don't rely on color alone: the text should say what the status is.
  • The dot is decorative (aria-hidden).