Introducing PrimeReact v11-alpha 🎉Discover Now

Badge

Badge is a small status indicator for another element.

Approved Rejected Warning Pending Draft Featured 3 NewOnline PrivateSecurity issue
preview

Installation#

npx shadcn@latest add @primereact/badge

Usage#

import { Badge } from '@/components/ui/badge';
<Badge>Badge</Badge>

Examples#

Basic#

Badge
basic-demo

Severity#

The severity property defines the visual style of a badge.

DefaultSecondarySuccessInfoWarningDangerContrast
severity-demo

Size#

Use the size property to change the size of a badge.

SmallDefaultLargeXLarge
size-demo

Overlay#

A badge can be added to any element by encapsulating the content with the OverlayBadge component.

2
4
overlay-demo

Button#

Buttons have built-in support for badges to display a badge inline.

button-demo

Accessibility#

Screen Reader#

Badge does not include any roles and attributes by default, any attribute is passed to the root element so aria roles and attributes can be added if required. If the badges are dynamic, aria-live may be utilized as well. In case badges need to be tabbable, tabindex can be added to implement custom key handlers.

Keyboard Support#

Component does not include any interactive elements.