Command Palette

Search for a command to run...

Badge

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

DefaultSecondaryOutlineDestructive

Installation

npm i @radix-ui/react-slot

Usage

1 2 3 4 5 import { Badge } from "@/components/ui/badge" export function BadgeDemo() { return <Badge variant="secondary">Badge</Badge> }

Examples

Variants

Default

Default

Secondary

Secondary

Outline

Outline

Destructive

Destructive

Custom Styling

Custom Color

Custom Color

Custom Shape

Custom Shape

Custom Border

Custom Border

With Icons

Check

Completed

Info

Information

Warning

Warning

Link & Interactive Badges

Link Badge

Dashboard

Secondary Link

Settings

Button Badge

Props

PropTypeDefaultDescription
variant'default' | 'secondary' | 'destructive' | 'outline''default'The visual style of the badge.
classNamestringundefinedAdditional CSS classes to apply to the badge.
asChildbooleanfalseWhen true, the badge will be rendered as its child element. Useful for links and buttons.