React Badges

Enterprise-grade badges in the language of industrial software: soft status washes with a dot plus label (state is never color alone), solid and outline variants, and monospaced technical tags for environments, versions, and silicon specs. Flat, sharp-cornered, token-driven.

Status — soft wash, dot + label

Operational
Degraded
Fault
Maintenance
Offline

Solid

Primary
Neutral
Critical

Outline

Default
Primary
Muted

Technical — mono, for environments, versions, specs

PROD
STAGING
v2.4.1
AXI4-128
16nm
SILICON-PROVEN

Interactive

Alerts3
filter: fab-2
Release notes

Sizes

xs
sm
md
lg

Installation

You can add this component to your project using the CLI or by manually copying the code.

npx shadcn@latest add badge.json

Usage

after installing the component, import it into your page or component file. The Badge component is the main component that you will use. It has many props that you can use to customize it.

Loading...

Props

The Badge component accepts the following props for comprehensive customization:

PropTypeDefaultRequiredDescription
childrenReactNode-NoThe content to display inside the badge
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl''md'NoControls the size of the badge
shape'rounded' | 'pill' | 'square' | 'circle''rounded'NoDefines the shape of the badge
animation'none' | 'pulse' | 'bounce' | 'float' | 'glow' | 'shake' | 'rotate' | 'scale' | 'gradient-shift''none'NoApplies animation effects to the badge
position'static' | 'absolute' | 'fixed' | 'sticky''static'NoCSS position property for the badge
iconLeftReactElement-NoIcon to display on the left side of the badge content
iconRightReactElement-NoIcon to display on the right side of the badge content
badgestring | number-NoNotification badge to display (e.g., count)
loadingbooleanfalseNoShows a loading spinner when true
classNamestring-NoAdditional CSS classes for custom styling
styleReact.CSSProperties{}NoInline styles for the badge
blur'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl''none'NoBackdrop blur effect intensity
opacitynumber-NoOpacity value for the badge (0-1)
shadow'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inner''none'NoShadow effect for the badge
glowbooleanfalseNoAdds a glowing effect to the badge
animationDuration'fast' | 'normal' | 'slow''normal'NoDuration of animations and transitions
disabledbooleanfalseNoDisables the badge and applies disabled styling
activebooleanfalseNoApplies active state styling
onDismiss(event: MouseEvent<HTMLButtonElement>) => void-NoCallback when dismiss button is clicked
onHover(event: MouseEvent<HTMLElement>) => void-NoCallback when badge is hovered
onFocus(event: React.FocusEvent<HTMLElement>) => void-NoCallback when badge receives focus
onClick(event: MouseEvent<HTMLButtonElement>) => void-NoMakes badge clickable as a button
hrefstring-NoMakes badge a link to the specified URL
topstring | number-NoTop position for absolute/fixed positioned badges
rightstring | number-NoRight position for absolute/fixed positioned badges
bottomstring | number-NoBottom position for absolute/fixed positioned badges
leftstring | number-NoLeft position for absolute/fixed positioned badges
zIndexnumber-NoZ-index for layering positioned badges
aria-labelstring-NoAccessibility label for screen readers
aria-describedbystring-NoID of element that describes the badge
rolestring-NoARIA role for accessibility

Examples

Here are some examples of how to use different props:

Loading...