Components

Badge

Badges display a small count or status indicator, optionally positioned over another element.

Replacing soon
GitHub
55 notifications

Anatomy

Anatomy
import {Badge} from '@staffbase/design';

<Badge />;

Examples

Variants

55 notifications55 notifications55 notifications55 notifications

Empty (dot) badge

When no value is provided, the badge renders as a small dot indicator.

New activity

Truncated value

Use truncate to cap the displayed number at 9+.

9+12 notifications9+100 notifications

Positioned over an element

Wrap a target element in a relative container, then place the Badge immediately after it. The position prop controls which corner the badge anchors to.

33 notificationsNew activity

Inline

Use position="inline" to render the badge as an inline element alongside text or other content.

Notifications

44 unread notifications

API reference

NameTypeDescription
a11yDescription
string
Visually hidden text to describe the badge value or status for screen readers.
value
number
The number to display on the badge. Omit for a dot indicator.
variant
primarysecondarycriticalgamification
Color style of the badge.
position
topLefttopRightbottomLeftbottomRightinline
Position of the badge relative to the preceding DOM element, or inline alongside content.
truncate
boolean
When true, displays 9+ for values greater than 9.
Default:false