Skip to content
FelicityUI

Badge

Displays a badge or a component that looks like a badge.

DefaultSecondaryDestructiveOutline

Installation

terminal
npx felicityui add badge --platform react

Usage

example.tsx
import { Badge } from "@/components/ui/badge"

<Badge variant="secondary">Live</Badge>

Default

DefaultSecondaryDestructiveOutline

Variants

Including ghost and link.

DefaultSecondaryDestructiveOutlineGhostLink

With icon

data-icon=inline-start | inline-end

VerifiedBookmark

With spinner

Same data-icon placement.

DeletingDeletingGeneratingGenerating

Custom colors

className overrides.

CopperHealthyAttention

RTL

dir=rtl

شارةموثّقإشارة

API Reference

PropTypeDefaultDescription
variantdefault | secondary | destructive | outline | ghost | linkdefaultVisual style.
renderReactElement—Compose as another element (e.g. anchor) while keeping badge styles.
classNamestring—Additional classes / custom colors.
badgeVariants({ variant?, className? }) => string—Exported class helper for applying badge styles without the component.

Accessibility

WCAG 2.2 AA

  • Non-interactive by default; when render is a link, use a real anchor.
  • Visible focus indicator when focusable.
  • Sufficient contrast on semantic token pairs.
  • Do not rely on color alone for status.

Platform notes

React

Native HTML with Felicity semantic tokens. Paper/ink surfaces, copper used sparingly, hairline borders — not Base UI / Radix runtime.

  • Server Component compatible unless marked use client.
  • Uses data-slot attributes for anatomy.
  • Supports render prop composition (link-as-badge) without Base UI.
  • Icons and Spinner use data-icon=inline-start|inline-end for placement.
  • Focus-visible rings use color.focus.ring.