Skip to main content
The Badge component is used to display small pieces of information like status indicators, counts, or labels.

Installation

npx shadcn@latest add @eo-n/badge

Usage

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

Examples

Default

<Badge>Default</Badge>

Secondary

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

Outline

<Badge variant="outline">Outline</Badge>

Destructive

<Badge variant="destructive">Destructive</Badge>

With Icon

import { CheckCircle } from "lucide-react";

<Badge>
  <CheckCircle />
  Complete
</Badge>
<Badge asChild>
  <a href="/docs">Documentation</a>
</Badge>

Component API

Badge

variant
'default' | 'secondary' | 'destructive' | 'outline'
The visual style variant of the badge.
  • default - Primary brand color background
  • secondary - Secondary color background
  • destructive - Red/error color background
  • outline - Transparent background with border
className
string
Additional CSS classes to apply to the badge.
children
React.ReactNode
The content to display inside the badge.
...props
React.ComponentProps<'span'>
All standard HTML span element props are supported.

Styling

The Badge component uses class-variance-authority for variant styling. You can customize the variants by modifying the badgeVariants definition or extend it with additional variants.

Build docs developers (and LLMs) love