Menu


Badge


A small status marker: a soft or flat pill with a label and optional icons.

Customize the preview


Choices
Show
View
Active

Options


Badge options
ChoiceValuesDefaultWhat it does
looksmbk-badge--look-<value>softflatsoft
Soft, the default, is the subtle surface inside an edge of the tone's color; flat is the tone's full surface. The default tone looks the same in soft and flat.
tonesmbk-badge--tone-<value>defaultsuccessinfowarningdangerdefault
A see-through gray that shows on every surface, or one of the four feedback families.
sizesmbk-badge--size-<value>lgmdsmlg
The pill scale shared with the chip and the tag: 32, 24 and 20 tall.

Partssmbk-badge__iconsmbk-badge__label

Examples


Usage

A soft badge with an icon: the default look, the tone color on its subtle surface inside an edge.

Verified

Tones

The tone is the meaning: a neutral gray that shows on any surface, or one of the four feedback colors.

DraftActiveIn reviewPendingFailed

Flat

The flat look fills the badge with the tone color, for a status that should stand out.

PaidScheduledOverdueCanceled

Sizes

Three heights, on the same scale as the chip and the tag.

DeployedDeployedDeployed

With icons

An icon at either end, or both.

NewChangelogv2.4.0

Counts

A count in the small size; its digits are all one width, so a number that changes keeps its place.

81199+

Guidelines


Purpose

A small, inert marker that states a status or a count beside the thing it describes: published, three unread, warning. It is not pressed and not removed, which is what separates it from a chip and a tag.

When to use

  • A status word on a row, a card or a heading.
  • A count on a navigation item.

When not to use

  • For something a person can press or dismiss. Use a chip or a tag.
  • For a category that is not a state. Use a tag.
  • For a dot that marks a status beside a name. Use the status dot.
  • As the only carrier of meaning by color. Give it a text or shape cue as well (WCAG 1.4.1 Use of Color).

Usage rules

Do

  • Keep the label to a word or a number.
  • Use the soft look, the default, for status almost everywhere; it stays quiet in dense lists. Use the flat look when the status should stand out.

Don't

  • Put a badge inside a button. The button's own label is the place for its state.
  • Rely on the tone's color alone; say the status in words.
PaidOverdue
Do

Keep the label to a word or a number, so the badge reads at a glance.

Payment received on 12 March from the finance team
Don't

A sentence in a badge stretches it and stops it reading as a status.

Do

Put a count in the button's own label, so the button reads as one control.

Don't

A badge inside a button competes with the label and looks like a second control.

Anatomy

  • The block, a pill that fixes its height by size, on the same scale as the chip and the tag. The default tone is a see-through gray with no edge, so it shows on any surface. A soft feedback badge draws a thin edge in its tone's own border color; a flat badge has none.
  • The label part, the text, in the label style. Numbers take equal-width digits, so a count that changes does not shift what is beside it.
  • The icon part, before or after the label. Optional.

Behavior

None. It renders and stays put.

Accessibility


What it does for you

  • A labeled badge is read as its text.
  • The text of both looks on its surface, soft and flat, is measured on the color foundation's Contrast section, in both themes. A pair that falls short there is corrected in Figma, not here.

What you must do

  • Say the status in the badge's words, or beside it with an icon, so it never rests on color alone.

How to test

  • With a screen reader, the badge is read as its text.
  • Tab past it: a badge takes no focus.

Source


The files the badge is made of. Its folder on GitHub (opens in a new tab) holds them with its wrapper and its document.

Stylesheet
badge.css
/* smbk-badge — Badge. Figma "Badge" 4126:20020.
 * One pill scale with the chip and the tag: heights on the mark sizes, Label MD
 * at lg and Label SM below it, padding and gap one step per size.
 * Soft is the default look, so a badge with no look class draws soft; flat
 * and the dot draw the tone's full surface. The default tone has one look, a
 * see-through gray with no edge, so it shows on every surface.
 * Every badge has an edge, clear unless its look draws one (the soft badges of
 * the four feedback tones). Figma draws the edge inside the badge, so each
 * padding gives the edge's width back and a badge with an edge is the same
 * size as one without.
 * Counts take equal-width digits, so a number that changes does not move its
 * neighbors. */

.smbk-badge {
  /* The default tone; each feedback tone's soft look sets these again below (the tone recipe). */
  --smbk-tone-surface: var(--smbk-color-surface-neutral-subtle);
  --smbk-tone-border: transparent;
  --smbk-tone-text: var(--smbk-color-text-default);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: var(--smbk-space-inline-sm);
  height: var(--smbk-size-mark-xl);
  padding: 0 calc(var(--smbk-space-inset-lg) - var(--smbk-border-width-hairline));
  border: var(--smbk-border-width-hairline) solid var(--smbk-tone-border);
  border-radius: var(--smbk-radius-full);
  background: var(--smbk-tone-surface);
  color: var(--smbk-tone-text);
  font-family: var(--smbk-typography-label-md-font-family);
  font-size: var(--smbk-typography-label-md-font-size);
  font-weight: var(--smbk-typography-label-md-font-weight);
  line-height: var(--smbk-typography-label-md-line-height);
  letter-spacing: var(--smbk-typography-label-md-letter-spacing);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.smbk-badge__icon {
  font-size: var(--smbk-size-icon-sm);
}

/* ---- size ---- */

.smbk-badge--size-md,
.smbk-badge--size-sm {
  gap: var(--smbk-space-inline-xs);
  font-family: var(--smbk-typography-label-sm-font-family);
  font-size: var(--smbk-typography-label-sm-font-size);
  font-weight: var(--smbk-typography-label-sm-font-weight);
  line-height: var(--smbk-typography-label-sm-line-height);
  letter-spacing: var(--smbk-typography-label-sm-letter-spacing);
}

.smbk-badge--size-md {
  height: var(--smbk-size-mark-lg);
  padding: 0 calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}

.smbk-badge--size-sm {
  height: var(--smbk-size-mark-md);
  padding: 0 calc(var(--smbk-space-inset-sm) - var(--smbk-border-width-hairline));
}

:is(.smbk-badge--size-md, .smbk-badge--size-sm) .smbk-badge__icon {
  font-size: var(--smbk-size-icon-xs);
}

/* The default tone is the block's own look above. */

/* ---- soft, the default: the tone recipe, the tone's subtle surface inside its pale edge ---- */

.smbk-badge--tone-success { --smbk-tone-surface: var(--smbk-color-feedback-success-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-success-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-success-text-on-subtle); }
.smbk-badge--tone-info { --smbk-tone-surface: var(--smbk-color-feedback-info-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-info-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-info-text-on-subtle); }
.smbk-badge--tone-warning { --smbk-tone-surface: var(--smbk-color-feedback-warning-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-warning-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-warning-text-on-subtle); }
.smbk-badge--tone-danger { --smbk-tone-surface: var(--smbk-color-feedback-danger-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-danger-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-danger-text-on-subtle); }

/* ---- flat and dot: the tone's full surface, with no edge ---- */

.smbk-badge--look-flat.smbk-badge--tone-success {
  border-color: transparent;
  background: var(--smbk-color-feedback-success-surface);
  color: var(--smbk-color-feedback-success-text-on-surface);
}

.smbk-badge--look-flat.smbk-badge--tone-info {
  border-color: transparent;
  background: var(--smbk-color-feedback-info-surface);
  color: var(--smbk-color-feedback-info-text-on-surface);
}

.smbk-badge--look-flat.smbk-badge--tone-warning {
  border-color: transparent;
  background: var(--smbk-color-feedback-warning-surface);
  color: var(--smbk-color-feedback-warning-text-on-surface);
}

.smbk-badge--look-flat.smbk-badge--tone-danger {
  border-color: transparent;
  background: var(--smbk-color-feedback-danger-surface);
  color: var(--smbk-color-feedback-danger-text-on-surface);
}

/* ---- dot: a bare mark, no label. Its words, if markup gives it any, stay hidden over the
   tone's text color above. ---- */

/* ---- high contrast (forced colors) ---- */
/* In Windows high-contrast mode the browser drops fills and shadows; this puts the meaning back with the
   user's own colors. Nothing here applies outside that mode. */

@media (forced-colors: active) {
  /* The dot is a fill and nothing else, so it would vanish. It takes the palette's text color. */
}
Tokens it reads
Badge tokens
Token and CSSValuePreviewFoundation
color.surface.neutral-subtle--smbk-color-surface-neutral-subtlelight: #373d431adark: #606a7533changes with themeColor
color.text.default--smbk-color-text-defaultlight: #232527dark: #e7ebf0changes with themeColor
space.inline.sm--smbk-space-inline-smcomfortable: 6pxcompact: 4pxchanges with densitySpacing
size.mark.xl--smbk-size-mark-xl32pxSize
space.inset.lg--smbk-space-inset-lgcomfortable: 12pxcompact: 8pxchanges with densitySpacing
border-width.hairline--smbk-border-width-hairline1pxBorder width
radius.full--smbk-radius-full9999pxRadius
typography.label-md--smbk-typography-label-md-font-family--smbk-typography-label-md-font-size--smbk-typography-label-md-font-weight--smbk-typography-label-md-line-height--smbk-typography-label-md-letter-spacing--smbk-typography-label-md-text-transformfontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 14pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px

The quick brown fox

Typography
size.icon.sm--smbk-size-icon-sm16pxSize
space.inline.xs--smbk-space-inline-xs4pxSpacing
typography.label-sm--smbk-typography-label-sm-font-family--smbk-typography-label-sm-font-size--smbk-typography-label-sm-font-weight--smbk-typography-label-sm-line-height--smbk-typography-label-sm-letter-spacing--smbk-typography-label-sm-text-transformfontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 12pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px

The quick brown fox

Typography
size.mark.lg--smbk-size-mark-lg24pxSize
space.inset.md--smbk-space-inset-mdcomfortable: 8pxcompact: 6pxchanges with densitySpacing
size.mark.md--smbk-size-mark-md20pxSize
space.inset.sm--smbk-space-inset-smcomfortable: 6pxcompact: 4pxchanges with densitySpacing
size.icon.xs--smbk-size-icon-xs12pxSize
color.feedback.success.surface-subtle--smbk-color-feedback-success-surface-subtlelight: #dffddfdark: #0a2d0echanges with themeColor
color.feedback.success.border-subtle--smbk-color-feedback-success-border-subtlelight: #8ddf90dark: #084712changes with themeColor
color.feedback.success.text-on-subtle--smbk-color-feedback-success-text-on-subtlelight: #016317dark: #8ddf90changes with themeColor
color.feedback.info.surface-subtle--smbk-color-feedback-info-surface-subtlelight: #e3ebfedark: #162352changes with themeColor
color.feedback.info.border-subtle--smbk-color-feedback-info-border-subtlelight: #b8ccffdark: #213583changes with themeColor
color.feedback.info.text-on-subtle--smbk-color-feedback-info-text-on-subtlelight: #2f4ab8dark: #b8ccffchanges with themeColor
color.feedback.warning.surface-subtle--smbk-color-feedback-warning-surface-subtlelight: #ffe6dbdark: #431b07changes with themeColor
color.feedback.warning.border-subtle--smbk-color-feedback-warning-border-subtlelight: #febea2dark: #692903changes with themeColor
color.feedback.warning.text-on-subtle--smbk-color-feedback-warning-text-on-subtlelight: #913900dark: #febea2changes with themeColor
color.feedback.danger.surface-subtle--smbk-color-feedback-danger-surface-subtlelight: #fee5e1dark: #4b130echanges with themeColor
color.feedback.danger.border-subtle--smbk-color-feedback-danger-border-subtlelight: #febdb2dark: #761812changes with themeColor
color.feedback.danger.text-on-subtle--smbk-color-feedback-danger-text-on-subtlelight: #a51d17dark: #febdb2changes with themeColor
color.feedback.success.surface--smbk-color-feedback-success-surface#037a1fColor
color.feedback.success.text-on-surface--smbk-color-feedback-success-text-on-surface#f9fafbColor
color.feedback.info.surface--smbk-color-feedback-info-surface#3b5ce3Color
color.feedback.info.text-on-surface--smbk-color-feedback-info-text-on-surface#f9fafbColor
color.feedback.warning.surface--smbk-color-feedback-warning-surface#b14904Color
color.feedback.warning.text-on-surface--smbk-color-feedback-warning-text-on-surface#f9fafbColor
color.feedback.danger.surface--smbk-color-feedback-danger-surface#cc0d0dColor
color.feedback.danger.text-on-surface--smbk-color-feedback-danger-text-on-surface#f9fafbColor
Manifest
badge.manifest.json
{
  "name": "badge",
  "block": "smbk-badge",
  "summary": "A small status marker: a soft or flat pill with a label and optional icons.",
  "adapt": "css",
  "axes": {
    "look": {
      "values": [
        "soft",
        "flat"
      ],
      "default": "soft",
      "description": "Soft, the default, is the subtle surface inside an edge of the tone's color; flat is the tone's full surface. The default tone looks the same in soft and flat."
    },
    "tone": {
      "values": [
        "default",
        "success",
        "info",
        "warning",
        "danger"
      ],
      "default": "default",
      "description": "A see-through gray that shows on every surface, or one of the four feedback families."
    },
    "size": {
      "values": [
        "lg",
        "md",
        "sm"
      ],
      "default": "lg",
      "description": "The pill scale shared with the chip and the tag: 32, 24 and 20 tall."
    }
  },
  "flags": {},
  "parts": [
    "icon",
    "label"
  ],
  "figmaNodeId": "4126:20020"
}