ui-kit0.0

Display

Badge

A small label for status or metadata.

Variants and sizes

Three neutral variants for metadata, in three sizes: 20, 24 and 28px tall.

DefaultSecondaryOutline
SmallMediumLarge

When to use

  • Short status or metadata next to a title or a table cell: Paid, Draft, Beta, v2.4.
  • A count on an icon button or avatar: unread messages, open tasks.
  • Removable tags and filters that the user adds and takes away.

Not for: actions (use a button), long text (use a description), or messages that need attention (use an alert).

Status tones

Success, warning, destructive and info use a faint tint with -text colour, so they stay readable in dark mode. Colour is only ever spent on status: pair it with a word or icon, never colour alone. dot adds a status dot; live makes it pulse for something happening right now.

PaidPendingFailedDraftLive
VerifiedExpires in 3 daysDeclinedNew

Removable

BadgeRemove is the only client part; the badge around it stays a Server Component. Give each × a label that names what it removes.

DesignFrontendAccessibilityQ4 roadmap

Counter on an icon button

BadgeAnchor pins a solid badge to the corner of the element beside it. Put the meaning in visually hidden text and in the button’s label.

3 unread12 new messages

API

Badge

PropTypeDefaultDescription
variant'default' | 'secondary' | 'outline' | 'success' | 'warning' | 'destructive' | 'info''default'Colour. The last four are status tones.
size'sm' | 'md' | 'lg''md'Height 20 / 24 / 28px.
solidbooleanfalseStatus tones: solid fill instead of a tint.
dotbooleanfalseLeading status dot.
livebooleanfalsePulsing dot. Implies dot.
asChildbooleanfalseRender the child (e.g. a link) with badge styles.
...propsHTMLAttributes<HTMLSpanElement>—Forwarded, including ref and className.

BadgeRemove

PropTypeDefaultDescription
aria-labelstring'Remove'Name what is removed: “Remove Design”.
...propsButtonHTMLAttributes—Forwarded to the <button>, including onClick.

BadgeAnchor wraps an element and a Badge. badgeClassName({ variant, size }) returns the classes; in plain HTML: ui-badge ui-badge-success.

Accessibility

  • A badge is plain text in a <span>: no role, so its text is read in order with its neighbours.
  • The status dot is decorative (aria-hidden); the word beside it carries the meaning.
  • Tones use the -text colour tokens, measured at 4.5:1 or better on surfaces in light and dark.
  • BadgeRemove is a real button with a label you supply; its hit area is 24px even though the × is smaller.

Motion

  • The live dot pulses once every 1.8s with an expanding ring.
  • A counter badge pops in on the soft-rise curve; the × presses to .88 on the snappy spring.
  • Reduced motion: the ring and pop are dropped; the dot stays.