Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Badge

A compact label for status, classification or a small count.

Preview

Live preview

Changes apply to this preview only.

Deployment readyVersion 1.0

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Sizes

sm, md and lg.

Open preview

Variants

The semantic tone of the label.

Open preview

Appearances

Solid, soft, outline and glass.

Open preview

Usage

Use semantic tone and appearance to reinforce a text label. The example enumerates tones from badgeVariantMap.

A Badge is a span and does not provide a dismiss action or button behavior. Use a real control for interaction.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluBadgeProps

Type source
PimoluBadgeProps public API
NameTypeDefaultDescription
variant"primary" | "secondary" | "neutral" | "success" | "warning" | "danger" | undefined"neutral"Variant exposed by this component.
appearance"solid" | "soft" | "outline" | "glass" | undefined"soft"Visual treatment of the control or surface.
size"sm" | "md" | "lg" | undefined"md"Component size.
radius"sm" | "md" | "lg" | "none" | "full" | undefined"md"Corner-radius treatment.
dotboolean | undefinedfalseDecorative status dot
startIconReactNode—Decorative leading icon
endIconReactNode—Decorative trailing icon
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onChangeChangeEventHandler<HTMLSpanElement, Element> | undefined—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLSpanElement> | undefined—Standard React/HTML attribute.
variant

"primary" | "secondary" | "neutral" | "success" | "warning" | "danger" | undefined

Default: "neutral"

Variant exposed by this component.

appearance

"solid" | "soft" | "outline" | "glass" | undefined

Default: "soft"

Visual treatment of the control or surface.

size

"sm" | "md" | "lg" | undefined

Default: "md"

Component size.

radius

"sm" | "md" | "lg" | "none" | "full" | undefined

Default: "md"

Corner-radius treatment.

dot

boolean | undefined

Default: false

Decorative status dot

startIcon

ReactNode

No default extracted.

Decorative leading icon

endIcon

ReactNode

No default extracted.

Decorative trailing icon

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onChange

ChangeEventHandler<HTMLSpanElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLSpanElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Write the meaning in text instead of using color alone.
  • If a status changes dynamically, announce the surrounding update appropriately; a static Badge is not a live region.
Read the accessibility guide →