Badge

A small label that states a fact.

Variants

Four weights, the same four names the Button uses.

DefaultSecondaryDestructiveOutline

A count, a status, a version. A badge is not a button: it says what something is, it does not invite a click. When it does need to navigate, hand it a link.

Installation

npx philcn@latest add badge

The file is written into your project. It is yours from then on — change it as you like.

Examples

Props

PropTypeWhat it does
Badge.variant"default" | "destructive" | "outline" | "secondary" | nullWhich of the four looks to wear.
Badge.asChildbooleanStyles the single child instead of rendering a <span>.
Badge.renderReactElement<unknown, string | JSXElementConstructor<any>>The same thing, the shadcn spelling.

Types are read from the library itself, so this table cannot describe an option the code no longer has. Everything else you pass goes straight to the underlying <span>.