Appica UIUI 1.0.0

Badge

A small label that highlights a status, count, or category.

Badge

Usage

Badge is a compact, non-interactive label for a piece of metadata — a status, a count, a tag, a category. It renders a <span> by default and sizes to its content. Pick a variant for the color scheme and a size for the scale; drop an icon next to the text and mark it with data-icon="start" / data-icon="end" so the padding tightens on that side.

To make a badge clickable — a filter chip, a category link — pass a render element (an <a> or <button>). The badge then becomes focusable and gains hover/press affordances automatically. For a user-removable token with a built-in dismiss control, reach for Chip instead.

Examples

Default

A single Badge with text children uses the primary variant at the md size.

Variants

Each variant carries a semantic color. The solid primary/secondary and tinted error/success/warning/info schemes draw attention to a status, while soft, outline, and primary-outline stay quieter for neutral metadata.

On dark backgrounds

The light variant is built for dark or photographic backgrounds — a translucent white fill that reads against the surface beneath it.

Sizes

Four sizes scale the badge from xs to lg. The text and any icons scale together.

With an icon

Place an icon before or after the text and tag it with data-icon="start" or data-icon="end" — the badge tightens the padding on that edge so the icon sits snug.

Icon only

The icon-sm, icon-md, and icon-lg sizes render a square badge for a lone icon. Give it an aria-label so the meaning is announced.

Notification count

Absolutely position a small badge against an icon button to surface an unread count. Keep the number in the badge and the count in its aria-label.

Pass a render element to turn the badge into a link — a plain <a> or a framework one like a Next.js <Link> — or a <button>. It becomes focusable and animates on hover and press.

RTL

Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.

The icon flips to the start (right) edge and the tightened padding follows, because both are expressed with logical properties. For setup details and caveats, see the RTL guide.

موثّقترقية

API reference

Badge is built on Base UI's useRender and renders a <span> by default. Pass a render element to swap the underlying tag (e.g. an <a> or <button>), which also makes it focusable and interactive; render and its state ({ variant, size }) follow Base UI's render conventions. Every other <span> (or the rendered element's) attribute is forwarded.

Accessibility

  • A plain Badge is a <span> — purely visual. Don't rely on color alone to convey meaning; back it with text (e.g. "Active", not just a green badge).
  • For an icon-only badge, supply an aria-label so the icon's meaning is announced.
  • For a count badge, keep the visible number short and put the full meaning in aria-label (e.g. "3 unread notifications").
  • When you make a badge interactive via render, render a real <a> or <button> so it's keyboard-focusable and announced with the correct role; the badge applies focusable styling automatically.
  • Hover/press transitions are skipped when the user prefers reduced motion.

© 2026 Appica UI. A free component library, crafted by the Appica team.