Skip to content

Badge ​

A small label for a status, count or category.

Open in Storybook to try every prop.

When to use ​

  • Showing a status ("Paid", "Overdue"), a count (unread messages) or a category ("Year 9") next to the thing it describes.

When not to use ​

  • Anything people can press (use Button).
  • Long messages or explanations (use text, or a callout).

Anatomy ​

PartRequiredNotes
containerYesPill shape with a 1px border.
labelYesShort text or a number.
leadingNoe.g. an icon.
trailingNoe.g. an icon.

Properties ​

PropertyTypeDefaultDescription
colorbasic | primary | red | green | blue | yellowbasicColour, by meaning (see Variants).
sizesm | md | lgmd

Variants ​

ColorUse forExample
basicNeutral information, categories, countsYear 9, 28 students
primaryEmphasisNew
greenPositive, donePaid, Enrolled
blueInformational, ongoingIn progress
yellowNeeds attention soonDue soon
redA problemOverdue

Sizes ​

SizeHeightPadding (x)GapIcon sizeText style
smspacing 5 (20px)spacing 1.5spacing 112pxxs, bold
mdspacing 6 (24px)spacing 2spacing 114pxxs, bold
lgspacing 7 (28px)spacing 2.5spacing 1.516pxsm, bold

States ​

Not interactive: one state only.

Content guidelines ​

  • One or two words, sentence case ("Due soon", not "DUE SOON").
  • Never wraps; keep it short rather than truncating.

Accessibility ​

  • Plain text (<span>), read in place with the surrounding content.
  • Colour must not be the only signal: the text says what the colour means.
  • White text on every solid colour meets WCAG AA (4.5:1 or more), except yellow, which uses black text (12:1).

Platform adaptation ​

PlatformImplementationDifferences
Web / desktop (Vue)Badge.vue—
iOS (SwiftUI)—Capsule-shaped Text.
Android (Compose)—Badge / AssistChip (non-clickable).

Tokens used ​

TokenUsed for
color white, blackbasic background, text
color black (15%)border
color primary, green, blue, yellow, redsolid backgrounds (black text on yellow)

Do / Don't ​

DoDon't
Pick the colour by meaning.Use colours for decoration, or make them clickable.

Released under the PolyForm Noncommercial License 1.0.0.