shadcn.io is not affiliated with official shadcn/ui
Badge examples · Standard
Badge with Icon on Right (Standard) for React
A default badge with a star icon after its label as a trailing indicator.
A trailing icon says something different from a leading one: an arrow to an external page, a chevron for more, an X to dismiss. This React badge puts a Lucide star after its label with data-icon="inline-end", so the Badge component sizes and spaces it. Use the end position when the icon tells people what happens next or adds a state to the label, rather than naming its category.
Preview
Installation
FAQ
How does the star sit after the label in React?
The icon comes after the word, with data-icon="inline-end" and aria-hidden="true". The badge styles use that attribute to tighten the padding on the icon's side.
Why hide the star from assistive tech?
The label is the word in the badge. The star is decoration.
aria-hidden="true" is already on the icon, so screen readers read the word and skip the star.
Does the star need its own color?
No. Lucide icons paint with currentColor, so the star uses the badge's text color and follows the variant, including in dark mode.
Which variant is this badge?
No variant is set, so it stays default, a primary fill. Set secondary, outline or destructive on Badge for those looks. The icon stays after the word.
Related
- Badge with Icon on Left (Standard)A default badge with a star icon before
- Badge with Link (Standard)A default badge rendered as a link that
- Badge with Icon on Right (Secondary)A secondary badge with a star icon after
- Badge with Text (Standard)A default badge with a short label for a
- Circular Badge with Count (Standard)A circular default badge showing a number
- Badge with Icon on Left (Destructive)A destructive badge with a star icon