Tessera UI

Badge

A small notification indicator that overlays other components. Two variants — Dot (plain circle) and Label (pill with text). Two appearances — Solid and Outline. Four sizes. Six colors. Five corner-rounding options.

Installation

pnpm add @tessinaui/ui

Usage

import { Badge } from "@tessinaui/ui";
{/* Dot */}
<Badge variant="dot" color="error" />

{/* Label with count */}
<Badge variant="label" size="sm" value="+99" />

{/* Label with text — grows horizontally to fit */}
<Badge variant="label" size="md" color="success" value="Accepted" />

{/* Outline appearance */}
<Badge variant="label" size="md" color="primary" appearance="outline" value="Pro" />

Playground

Preview
Loading...

Showcase

All sizes, variants, appearances, and colors:

Preview
Loading...

API Reference

Props

PropTypeDefaultDescription
variant"dot" | "label""dot"dot — plain circle; label — pill that grows horizontally with text
appearance"solid" | "outline""solid"solid — filled background; outline — transparent bg, colored border + text
size"xs" | "sm" | "md" | "lg""sm"Diameter / height: 8 / 16 / 20 / 24 px
color"error" | "warning" | "success" | "info" | "primary" | "secondary""error"Color token used for background (solid) or border + text (outline)
rounded"full" | "lg" | "md" | "sm" | "none""full"Corner rounding for label badges — dots are always rounded-full
valuestringText content for the label variant. Badge grows horizontally to fit.
classNamestringExtra classes on the <span>

All other native <span> attributes are forwarded.

Sizes

SizeDiameterLabel textUse case
xs8 px— (dot only)Minimal presence indicator
sm16 px10 pxIcon button overlays, nav items
md20 px12 pxStandard notification counts
lg24 px12 pxLarger UI elements

xs is dot-only. Passing variant="label" at xs renders a dot without text.

Appearances

{/* Solid — filled background with on-color text */}
<Badge variant="label" size="md" color="error"   appearance="solid"   value="+99" />

{/* Outline — transparent background, colored border and text */}
<Badge variant="label" size="md" color="primary" appearance="outline" value="Pro" />

Colors

ColorSolid bgOutline border/textUse case
errorbg-errorring-error text-errorUnread counts, notifications (default)
warningbg-warningring-warning text-warningAttention needed
successbg-successring-success text-successPositive / completed
infobg-inforing-info text-infoInformational
primarybg-primaryring-primary text-primaryHighlighted / featured
secondarybg-secondaryring-border text-foregroundNeutral / low emphasis

Accessibility

  • Renders as <span> — wrap in a parent with aria-label describing the notification context
  • For screen readers, add <span className="sr-only">3 unread notifications</span> alongside the badge

On this page