shadcn.io is not affiliated with official shadcn/ui
Badge examples · Standard
Badge with Text (Standard) for React
A default badge with a short label for a status, a feature tag or a category.
Badges are the small labels you see everywhere: New, Beta, Premium, Verified. This React badge uses the Badge component's default variant, filled with your theme's primary color, for the state, feature or category you most want noticed. It renders a span that keeps its text on one line, so it sits inline beside a heading, in the corner of a card or in a table cell.
Preview
Installation
FAQ
Which variant is this badge?
No variant is set, so it stays default: the theme's primary fill and primary text. The other values are secondary, outline, ghost, link, destructive, info, success and warning.
How do I change the size or round it fully?
size takes sm, md or lg. pill rounds the badge fully. This demo sets neither, so you get the normal label.
Why doesn't the label wrap?
The badge is whitespace-nowrap, so the label stays one line. Shorten the text. A sentence belongs in an Alert.
How does the badge sit next to other text?
It is inline-flex and w-fit, so it hugs the label and stays on the line with a heading or a table cell. shrink-0 keeps it from being squashed in a tight row.
Related
- Badge with Link (Standard)A default badge rendered as a link that
- Badge with Icon on Left (Standard)A default badge with a star icon before
- Badge with Text (Secondary)A secondary badge with a muted label for
- Badge with Text (Outline)An outline badge with a bordered label
- Badge with Text (Destructive)A destructive badge for an error, a
- Circular Badge with Count (Standard)A circular default badge showing a number