Command Palette

Search for a command to run...

Docs
Badge

Badge

Small status descriptors for UI elements.

Badge

Installation

Run the following command:

Update your imports:
import { Badge } from "@/components/ui/badge"

Usage

import { Badge } from "@/components/ui/badge";
 
export default function Home() {
  return (
    <Badge>New</Badge>
  );
}

Props

PropTypeDefaultDescription
variantdefault | secondary | destructive | outline | ghost | link | success | warning | infodefaultStyle variant of the badge
sizeicon | xs | sm | md | default | lg | xl | 2xldefaultSize of the badge

HTML Attributes

The Badge component is built with a standard HTML div element and supports all its attributes:
  • id
  • onClick
  • role
  • tabIndex
  • aria-* attributes
  • data-* attributes
  • Event handlers like onMouseEnter, onFocus, etc.
The Badge component ensures proper accessibility through appropriate HTML attributes.