Blueprint

Badge

Badges are simple tile-like elements that contain short descriptive text.

LightDarkWarningDangerSuccessInfo

Design guidance

When and how to use this

Badges can be used to indicate the status of an element whether in the context of a Card or a Table row. Choose the color variant that best matches the underlying message you're trying to convey. For example, a Badge with the text "FAILED" intended to indicate that a measurement job has failed should use the Danger variant in Figma, colorScheme="danger" in React, or the .bg-danger class when using Bootstrap.

When to consider something else

Badges are not interactive, and so should not be used in cases where you want to allow the user to add or remove them, or otherwise interact with them. You might consider the Tag component for such cases.


React

PropDescription
colorSchemeSets the background and text color of the Badge based on semantic meaning
variantSets the overall visual appearance
colorModeShow light or dark - for use with variants

ColorSchemes

live

<Stack direction="row" spacing="100">
<Badge colorScheme="warning">Warning</Badge>
<Badge colorScheme="danger">Danger</Badge>
<Badge colorScheme="success">Success</Badge>
<Badge colorScheme="info">Info</Badge>
</Stack>

Variants

live

<>
<Stack direction="row" spacing="100" padding={200}>
<Badge colorMode="light" variant="primary">Primary</Badge>
<Badge colorMode="light" variant="secondary">Secondary</Badge>
<Badge colorMode="light" variant="glass">Glass</Badge>
</Stack>
<Stack direction="row" spacing="100" bgColor="neutral.900" padding={200}>
<Badge colorMode="dark" variant="primary">Primary</Badge>
<Badge colorMode="dark" variant="secondary">Secondary</Badge>
<Badge colorMode="dark" variant="glass">Glass</Badge>
</Stack>
</>

Bootstrap

Use the .badge class and one of the bg-* color scheme classes on a <span> element to make a Badge. For warning use cases, add .text-dark to ensure your Badge meets WCAG 2.1 AA color contrast.

Note

Bootstrap has 3 color scheme variants that do not map directly to semantic colors in our system. We map info, light, and dark as shown in the table below. However, we do not recommend using these color variants.

live

<span class="badge bg-primary">Primary</span>
<span class="badge bg-warning text-dark">Warning</span>
<span class="badge bg-danger">Danger</span>
<span class="badge bg-neutral">Neutral</span>
<span class="badge bg-success">Success</span>


ClassBackground colorText color
.bg-primaryprimary 600neutral 0
.bg-warningwarning 500neutral 700 (via .text-dark)
.bg-dangerdanger 500neutral 0
.bg-neutralneutral 600neutral 0
.bg-successsuccess 500neutral 0
.bg-info (not recommended)brand navy 400neutral 0
.bg-light (not recommended)neutral 100neutral 700 (via .text-dark)
.bg-dark (not recommended)neutral 700neutral 0

Copyright © 2024 Hover Inc. All Rights Reserved.