shadcn.io is not affiliated with official shadcn/ui
Badge examples · Destructive
Badge with Link (Destructive) for React
A destructive badge rendered as a link that underlines on hover, leading to error details.
A destructive badge that does something beats a static red label. This React badge renders a link in the Badge component's destructive variant, with hover:underline as the cue, so people can go straight from the problem to its details. Use it for error counts that open the log, failed statuses that open the retry page or critical alerts that open the incident: it makes a problem actionable instead of just visible.
Preview
Installation
FAQ
How does this badge become a link in React?
This demo underlines the link on hover.
Pass render with an a and its href, as this file does with href="#link". className="hover:underline" stays on Badge.
Use a real URL, not #.
What does variant destructive change on the link?
variant="destructive" keeps text-destructive and bg-destructive/10 on the link. Hover deepens that tint, and this file adds hover:underline.
Can I reach the link from the keyboard?
Yes. It is an a with an href, so Tab focuses it and Enter follows it. Screen readers announce a link.
Should a toggle filter be this badge?
No. This pattern goes to another page. An on and off filter is a Button or a toggle.
Related
- Badge with Text (Destructive)A destructive badge for an error, a
- Badge with Icon on Left (Destructive)A destructive badge with a star icon
- Badge with Link (Outline)An outline badge rendered as a link that
- Badge with Link (Standard)A default badge rendered as a link that
- Error with Title and Action AlertA destructive alert with a title and
- Circular Badge with Count (Destructive)A circular destructive badge showing a