Faber UI
Components

Badge

A small status descriptor for labels, counts, and categories.

Badge uses the Base UI useRender hook so it can be rendered as any element via the render prop while keeping its variants.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/badge.json

Usage

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

export default function Example() {
  return <Badge>New</Badge>;
}

Examples

Variants

DefaultSecondaryOutlineDestructiveGhostLink

Use the render prop to turn the badge into an anchor:

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

export default function Example() {
  return <Badge render={<a href="/changelog" />}>v1.0</Badge>;
}

API

The Badge accepts a variant prop ("default", "secondary", "outline", "destructive", "ghost", "link"), a render prop for composition, and all <span> attributes.

Last updated on

On this page