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
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/badge.jsonUsage
import { Badge } from "@/components/ui/badge";
export default function Example() {
return <Badge>New</Badge>;
}Examples
Variants
DefaultSecondaryOutlineDestructiveGhostLink
As a link
Use the render prop to turn the badge into an anchor:
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