adn-ui
Components

Badge

A customizable badge component for status indicators, counts, and tags.

The Badge component renders small visual indicators for statuses, categories, or notifications.

Usage

import { Badge } from "@/components/ui/badge";

export function ExampleBadge() {
  return <Badge variant="secondary">New</Badge>;
}

Preview

Default
Secondary
Destructive
Outline

Custom Styling

Extend or override standard badge styles using inline className Tailwind utilities:

<div className="flex flex-wrap items-center gap-3">
  <Badge className="bg-gradient-to-r from-violet-600 to-indigo-600 text-white border-0 shadow-sm">
    Gradient Accent
  </Badge>
  <Badge className="bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20">
    Online
  </Badge>
  <Badge className="bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20">
    Pending
  </Badge>
</div>

Gradient Accent

Online

Pending

Styling & Class Names

The Badge component generates BEM CSS class names and variant classes:

Class NameElement / SlotDescription
.badgeRoot containerBase badge flex alignment, padding, and font styles.
badge--defaultDefault variantPrimary color palette.
badge--secondarySecondary variantMuted secondary background color.
badge--destructiveDestructive variantHighlighting destructive state.
badge--outlineOutline variantBordered transparent background.
badge--smSmall sizeCompact padding and text size.
badge--mdMedium sizeStandard badge dimensions.
badge--lgLarge sizeExpanded badge dimensions.

API Reference

Badge Props

PropTypeDefaultDescription
variant'default' | 'secondary' | 'destructive' | 'outline''default'Visual color style of the badge.
size'sm' | 'md' | 'lg''md'Size variant of the badge.
classNamestringundefinedAdditional inline CSS utility classes.

On this page