Skip to main content
BM

Badge

A short, non-interactive label, such as one item of a tech stack or a status.

View source on GitHub

DraftPublishedIn review
BadgeExample.tsx
import { Badge } from "@/components/Badge";
import { Stack } from "@/components/Stack";

export function BadgeExample() {
  return (
    <Stack direction="horizontal" gap="xs">
      <Badge>Draft</Badge>
      <Badge variant="success">Published</Badge>
      <Badge variant="warning">In review</Badge>
    </Stack>
  );
}

Examples

Variants

NeutralAccentAccent 2LiveBetaDeprecated

Sizes

SmallMedium

With an icon

LiveOpen source

A tech stack, as a list

  • React
  • TypeScript
  • AWS

In running text, with inline markup

This site is Live and Built with Vite.

Wraps instead of overflowing

Infrastructure as code
Internationalization

Customized with component tokens

Custom
CSS
.customBadge {
  --component-badge-neutral-border: var(--color-border-strong);
  --component-badge-padding-inline-md: var(--space-inline-md);
}

Props

Any native prop not listed here goes to the root element unchanged.

A status badge's wording must state the status on its own. Inside a list, use as="li". Icon names come from Icon's registry. Its type matches Typography's label look: the same family and tracking tokens.

Badge props
PropTypeDefaultDescription
as"span" | "li""span"The root element.
variant"neutral" | "accent" | "accent-2" | "success" | "warning" | "error""neutral"neutral, accent and accent-2 are emphasis only; success, warning and error carry meaning.
size"sm" | "md""md"Text size and padding.
iconIconName—Decorative icon before the text.

Component tokens

Badge component tokens
TokenCopyDescriptionAliasesLightDarkPreview
--component-badge-font-familyBadge font (mono).type.family.label'Fira Code Variable', 'Fira Code Fallback', ui-monospace, SFMono-Regular, Menlo, Consolas, monospacefrom type.font-stack.mono'Fira Code Variable', 'Fira Code Fallback', ui-monospace, SFMono-Regular, Menlo, Consolas, monospacefrom type.font-stack.mono
--component-badge-font-size-smSmall badge text.type.size.label0.75remfrom type.font-size.xs0.75remfrom type.font-size.xs
--component-badge-font-size-mdStandard badge text.type.size.small0.875remfrom type.font-size.sm0.875remfrom type.font-size.sm
--component-badge-trackingLetter spacing of the uppercase label.type.tracking.label0.16emfrom type.letter-spacing.160.16emfrom type.letter-spacing.16
--component-badge-font-weightBadge text weight, the same inside headings and bold text.type.weight.body400from type.font-weight.400400from type.font-weight.400
--component-badge-line-heightBadge line height.type.leading.body1.6from type.line-height.normal1.6from type.line-height.normal
--component-badge-radiusBadge corners: a pill, unlike the buttons.radius.pill9999pxfrom radius.full9999pxfrom radius.full
--component-badge-padding-inline-smInline padding of small badges.space.inline.sm0.5remfrom space.20.5remfrom space.2
--component-badge-padding-inline-mdInline padding of standard badges.space.inline.sm0.5remfrom space.20.5remfrom space.2
--component-badge-gapSpace between a badge's icon and its text.space.inline.xs0.25remfrom space.10.25remfrom space.1
--component-badge-border-widthBadge outline width.effect.border.width2pxfrom effect.line.22pxfrom effect.line.2
--component-badge-neutral-backgroundNeutral badge fill.color.surface.sunken#f2ede2from color.sand.100#060a13from color.slate.1000
--component-badge-neutral-textNeutral badge text.color.text.muted#455464from color.gray.700#e6ecf3from color.slate.100
--component-badge-neutral-borderNeutral badge outline (decorative).color.border.subtle#e5dccbfrom color.sand.200#272f3ffrom color.slate.800
--component-badge-accent-backgroundAccent badge fill.color.accent.background#e0f6fefrom color.cyan.50#00242efrom color.cyan.950
--component-badge-accent-textAccent badge text.color.accent.text#005f7bfrom color.cyan.700#54d8f4from color.cyan.300
--component-badge-accent-borderAccent badge outline (decorative).color.accent.border#1c87a5from color.cyan.500#54d8f4from color.cyan.300
--component-badge-accent-2-backgroundSecond accent (violet) badge fill.color.accent-2.background#f4f0fdfrom color.violet.50#2a1f52from color.violet.900
--component-badge-accent-2-textSecond accent (violet) badge text.color.accent-2.text#5b3fa6from color.violet.600#c9b8f5from color.violet.300
--component-badge-accent-2-borderSecond accent (violet) badge outline (decorative).color.accent-2.border#5b3fa6from color.violet.600#c9b8f5from color.violet.300
--component-badge-success-backgroundSuccess badge fill. Never the only cue: the wording must state the status (WCAG 1.4.1).color.success.background#e8f5eefrom color.green.50#11352afrom color.green.900
--component-badge-success-textSuccess badge text. Never the only cue: the wording must state the status (WCAG 1.4.1).color.success.text#1e6b45from color.green.700#8fd6a8from color.green.300
--component-badge-success-borderSuccess badge outline (decorative).color.success.border#2a8556from color.green.600#5fbf86from color.green.400
--component-badge-warning-backgroundWarning badge fill. Never the only cue: the wording must state the status (WCAG 1.4.1).color.warning.background#fdf0e6from color.orange.50#45230dfrom color.orange.900
--component-badge-warning-textWarning badge text. Never the only cue: the wording must state the status (WCAG 1.4.1).color.warning.text#94440afrom color.orange.700#f7ad7cfrom color.orange.300
--component-badge-warning-borderWarning badge outline (decorative).color.warning.border#b25a12from color.orange.600#ec8c4efrom color.orange.400
--component-badge-error-backgroundError badge fill. Never the only cue: the wording must state the status (WCAG 1.4.1).color.error.background#fceceafrom color.red.50#4a1a1cfrom color.red.900
--component-badge-error-textError badge text. Never the only cue: the wording must state the status (WCAG 1.4.1).color.error.text#b3261efrom color.red.700#f4a097from color.red.300
--component-badge-error-borderError badge outline (decorative).color.error.border#c8372cfrom color.red.600#e8776cfrom color.red.400

Accessibility

  • Plain text in a span or li: not focusable, no pointer cursor, no hover state.
  • neutral, accent and accent-2 are emphasis only: the choice between them must not carry information, so color alone is fine. success, warning and error carry meaning, so the wording must state the status on its own (WCAG 1.4.1); the color and any icon are extras.
  • The icon is decorative and hidden from screen readers.
  • The uppercase is CSS only, so write the source text in normal case: copy and paste, reader modes and some browsers keep it. Other browsers pass the capitals on to screen readers, so avoid short words that read as acronyms.
  • Badges wrap rather than overflow at narrow widths and high zoom (WCAG 1.4.10).