Make your AI a shadcn expert

Shadcn Badge

React badge for status, counts, and labels. Built with TypeScript and Tailwind CSS for Next.js using Base UI — six variants, icons, and render links on a span.

A badge is a compact label for status, a count, or a tag. It is a span. Use render={<a href="…" />} for a link. Keep the text to a word or two.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same badge, thicker borders. The NeoBrutalism badge is the kit if you want that look.

Usage

import { Badge } from "@/components/ui/badge"
<Badge variant="secondary">Beta</Badge>

variant is default, secondary, destructive, outline, ghost, or link. render={<a href="…" />} makes it a link.

Composition

Badge

render={<a href="…" />} merges the badge onto the link. Switch to Radix UI for asChild.

Variants

variant picks the color. Ghost is quiet; destructive is the red one.

Scroll to load preview...

With Icon

data-icon="inline-start" or data-icon="inline-end" so the icon stays on the reading-start or reading-end side.

Scroll to load preview...

With Spinner

Same data-icon attributes on Spinner. Pair it with a word — Deleting, Generating — not a bare spinner.

Scroll to load preview...

render={<a href="…" />} plus the label as children. Hover comes from the [a&] selectors on the variants.

Scroll to load preview...

Custom Colors

Class names on Badgebg-green-50 text-green-700 dark:bg-green-950 dark:text-green-300. Leave variant at default.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Keep data-icon="inline-start" / inline-end so icons flip with the text.

Scroll to load preview...

API

Prop

Type

Notes

Give counts a name

A badge that says 3 is silent context. aria-label="3 unread messages" or an sr-only span. Same for icon-only badges.

Keep the label to a word or two. A sentence belongs in an Alert.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.