Skip to content
Storybook

Badge

Short status or category label. Subtle for most UI, Solid for emphasis, Outline on busy backgrounds.

Preview

React · live from the Storybook

HTML and CSS

The same component as plain HTML with pixels-ui.css, no framework needed.

Draft New Active Pending Overdue Beta

Usage

  • Keep to 1–2 words.
  • Color must not be the only cue: pair with text or an icon.

Installation

Included in the core files. No extra install.

HTML
<link rel="stylesheet" href="/css/pixels-tokens.css">
<link rel="stylesheet" href="/css/pixels-ui.css">
<script src="/js/pixels-ui.js" defer></script>

Examples

Styles

Subtle (default), Solid and Outline.

SubtleSubtleSubtle
SolidSolidSolidSolidSolid
OutlineOutlineOutline

Sizes, icon and close

Small Medium Large

Count

Numeric counter. Cap at 99+.

899+32

API reference

Class / attributeTypeDescription
px-badgeclassNeutral subtle by default.
px-badge--brand · --success · --warning · --danger · --infoclassColor.
px-badge--solid · --outlineclassStyle.
px-badge--sm · --lgclassSize.
px-badge__dot · px-badge__closeclassDot and close button.
px-count · --danger · --neutral · --smclassBadge / Count.

Figma properties

Badge54 variants · page “Badge”Open

Short status or category label. Subtle for most UI, Solid for high emphasis, Outline on busy backgrounds. Keep to 1–2 words; colour must not be the only cue (pair with text or icon).

PropertyTypeValues
LabelText“Label”
DotBoolean—
Leading iconBoolean—
Leading icon swapInstance swap—
CloseBoolean—
ColorVariantNeutral Brand Success Warning Danger Info
StyleVariantSubtle Solid Outline
SizeVariantSmall Medium Large
Badge / Count6 variants · page “Badge”Open

Numeric counter for notifications and unread items. Cap at 99+.

PropertyTypeValues
CountText“8”
ColorVariantBrand Danger Neutral
SizeVariantSmall Medium

Design tokens

Component tokens from the Figma Component collection. Override them to restyle just this component.

TokenAliasLight value
--px-badge-neutral-subtle-contentcolor-content-neutral-secondary#475467
--px-badge-success-subtle-contentcolor-content-success-default#027a48
--px-badge-danger-subtle-contentcolor-content-danger-default#b42318
--px-badge-radiusradius-full999px
--px-badge-gapspacing-44px
--px-badge-count-size-sm16px16px
--px-badge-count-size-md20px20px
--px-badge-heightspacing-2020px
--px-badge-padding-xspacing-88px

Accessibility

  • Counts on icons need an accessible name, e.g. aria-label="8 unread".