UI.MD

Badge

A small status indicator with multiple semantic variants.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/badge.json

Usage

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

Examples

Default

Default

Variants

DefaultSuccessWarningDestructiveMutedOutline

Sizes

SmallDefaultLarge

With Icon

FeaturedActivePendingFailedDraftLabel

API Reference

PropTypeDefaultDescription
variant"default" | "success" | "warning" | "destructive" | "muted" | "outline""default"Semantic variants tint the background and text; outline renders bordered and transparent.
size"sm" | "default" | "lg""default"Scales padding, text, and icon size together: sm is 11px text, default 12px, lg 13px. Every size sits a step below the control type around it, so a badge reads as a label rather than a button.
iconReact.ReactNode-Optional icon element rendered before the label, e.g. <Star />. Scales with the badge size.