Elements Pro launch: $79 for the first 50 with LAUNCH50 · $129 standard.

Components / Properties / Badge

Badge.

FreePrimitive

A compact property chip with semantic variants.

Demo dataResponsive
DefaultSecondaryOutlineDestructive

Installation

pnpm dlx shadcn@latest add https://elements.micropreneur.dev/r/badge.json

The shadcn CLI writes the source into your project. Files added:

  • components/ui/badge.tsxui
  • lib/utils.tslib
Dependencies@base-ui/reactclass-variance-authorityclsxtailwind-merge

API

PropTypeDefaultDescription
variant'default' | 'secondary' | 'destructive' | 'outline''default'

Also accepts useRender.ComponentProps<'span'>.

Accessibility

  • Renders a span by default; pass render to use a link or other element.
  • Badges are labels, not controls. Pair color variants with clear text.