Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Badge examples · Destructive

Badge with Icon on Right (Destructive) for React

A destructive badge with a star icon after its label for errors with a trailing indicator.

Framework
UI library

A trailing icon feels like an action or a consequence. This React badge puts a Lucide star after its label in the Badge component's destructive variant, with data-icon="inline-end" so the badge sizes and spaces the icon. Swap the star for what comes next: an arrow after Failed for a retry, an X after Delete, a clock after Expired. The icon follows the label in reading order.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

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.

What does variant destructive change?

variant="destructive" sets text-destructive on bg-destructive/10. The star stays after the word and picks up that text color.

How do I change the badge size?

size on Badge takes sm, md or lg, and pill rounds the badge fully. This demo sets neither, so the label stays the normal height.

Can I use a different icon?

Yes. Replace the star and keep the attributes this demo puts on the icon.