Skip to content

Design system

Documentation

DesignComponents / Badge

Components / Badge

Beta

Badge

Use Badge for a short status or classification label that supports nearby content.

On this page

Examples

Semantic states

Readable words carry the meaning alongside semantic color roles.

DraftReviewOperationalNeeds reviewFailedQueued

Badge examples for neutral and semantic states

Color palettes

Use a supported hue for neutral Badge treatments without reaching for raw color values.

RedOrangeAmberYellowLimeGreenTealCyanBlueIndigoVioletPink

Badge color palette comparison

Density

Small, default, and large labels align with nearby content.

SmallDefaultLarge

Badge size comparison

Status with a clear label

Never use a color-only dot when a state affects understanding.

Operational

Badge status with readable text

In a list or Card

Badge adds metadata without turning the surrounding surface into a control; use the playground to compare hue and treatment.

Atlas onboardingActive

A status label in a compact list row.

Badge inside a list row

When to use

Use Badge for a short label such as a lifecycle state, role, or queue. Use body text or an Alert when people need an explanation, next step, or announcement.

Usage

badge-basic.tsx
import { Badge } from "@phuctech/ui/components/badge";

export function Example() {
  return <Badge variant="success">Operational</Badge>;
}

Variants

Badge variants and intended meaning
VariantUse for
defaultPrimary classification or neutral emphasis.
secondaryQuiet metadata on a secondary surface.
outlineLow-emphasis labels where a boundary is useful.
success, warning, danger, infoSemantic states; always pair color with a readable word.
colorPaletteExplicit hue for default, secondary, and outline treatments. Semantic states keep their fixed meaning.

API

Component API
PropTypeDefaultDescriptionConstraints
variant"default" | "secondary" | "outline" | "success" | "warning" | "danger" | "info""default"Visual and semantic emphasis.Do not rely on color as the only state signal.
size"sm" | "md" | "lg""md"Badge height and text density.Keep labels short enough to scan.
colorPalette"neutral" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "teal" | "cyan" | "blue" | "indigo" | "violet" | "pink"Hue for default, secondary, and outline treatments.Semantic variants retain their success, warning, danger, or info role.
childrenReactNoderequiredThe readable label.Use a concise word or phrase; do not leave it empty.

Tokens

Component tokens
TokenRoleEffective valueUsage
--color-*-bg / --color-*-textSemantic statesuccess / warning / danger / infoBackground and text roles keep status readable in both themes.
--radius-*Pill geometryfull radiusThe label reads as metadata rather than a control.
--size-control-*Label heightsm / md / lgKeeps inline labels aligned with nearby controls.

Accessibility

  • Write the state in the label: “Operational” is better than a green dot alone.
  • Use sufficient contrast for the label and boundary in both themes.
  • Do not make Badge interactive; use Button or a link when it needs activation.

Do and don’t

Do

Keep the label short, readable, and redundant with the color meaning.

Don’t

Put paragraphs, controls, or the only error explanation inside a Badge.

  • Card provides the surface where a status label often belongs.
  • Colors documents semantic status roles and contrast checks.