Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Badge for React

A compact label for status, counts, and categories.

BadgeSecondaryDestructiveOutline

Installation

bunx --bun shadcn@latest add https://kit.dev/r/base/badge.json

Usage

import { Badge } from "@/components/ui/badge";
<div className="flex w-full flex-wrap justify-center gap-2">
  <Badge>Badge</Badge>
  <Badge variant="secondary">Secondary</Badge>
  <Badge variant="destructive">Destructive</Badge>
  <Badge variant="outline">Outline</Badge>
</div>

Demos

Variants

Use the variant prop to change the variant of the badge.

Icon

Render an icon inside the badge. Use data-icon="inline-start" or data-icon="inline-end" for placement.

Spinner

Render a spinner inside the badge. Add data-icon="inline-start" or data-icon="inline-end" on the spinner.

Use asChild to render a link as a badge.

Colors

Customize badge colors with classes such as bg-green-50 dark:bg-green-800.

Rtl

Right-to-left badge. See the RTL configuration guide for document direction.

API Reference

Badge

PropType
className?string