shadcn.io is not affiliated with official shadcn/ui
Badge examples · Outline
Badge with Link (Outline) for React
An outline badge rendered as a link that underlines on hover, for tag pages and category filters.
An outline badge that goes somewhere turns a passive label into navigation. This React badge renders a link in the Badge component's outline variant, with hover:underline as the cue. Use it for tags that open a filtered view, category badges that open their page, or metadata labels that open details: links that invite exploring without the weight of a filled badge.
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 outline change on the link?
variant="outline" keeps the border-border edge and text-foreground on the link. Hover adds the variant's background, 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 (Outline)An outline badge with a bordered label
- Badge with Icon on Left (Outline)An outline badge with a star icon before
- Badge with Link (Standard)A default badge rendered as a link that
- Badge with Link (Destructive)A destructive badge rendered as a link
- Circular Badge with Count (Outline)A circular outline badge showing a number
- Breadcrumb with Ellipsis (Standard)A breadcrumb trail with a text Home link