Skip to main content

Overview

The Badge component displays small, pill-shaped labels with semantic color variants. Useful for tags, status indicators, and metadata labels.

Import

Basic Usage

Variants

The Badge component supports five color variants:
Neutral gray variant for general-purpose labels. This is the default variant.

Sizes

Two size options are available:
  • sm - Padding: 8px/2px (2/0.5), Font: 10px, Tight leading
  • md - Padding: 10px/2px (2.5/0.5), Font: 12px (xs) - Default

Props

'default' | 'accent' | 'success' | 'destructive' | 'warning'
default:"default"
The color variant of the badge.
'sm' | 'md'
default:"md"
The size of the badge.
string
Additional CSS classes to apply.
The Badge component extends HTMLAttributes<HTMLSpanElement>, so all standard span attributes are supported.

Design Details

  • Rounded-full shape (pill-shaped)
  • Border with matching color variant
  • Smooth color transitions
  • Font: sans-serif family, medium weight
  • Inline-flex layout for proper alignment

Examples

Status Indicators

With Icons

Small Size for Compact UI

Component Definition

Location: packages/gadget-ui/src/components/badge.tsx:28 The Badge is a simple functional component that renders a <span> element.