Skip to main content

An official website of the United States government

Here's how you know

An official website of the United States government

Here's how you know

Theme:

Design system switcher

Version:

Design system switcher

Theme:

Design system switcher

Version:

Design system switcher

Badge

Badges hold small amounts of information and draw attention to new or important content.

Examples

Default

Loading

Alert

Loading

Warning

Loading

Success

Loading

Informational

Loading

Code

React

See Storybook for React guidance of this component.

Web Component

See Storybook for Web Component guidance of this component.

Style customization

The following CSS variables can be overridden to customize Badge components:

CSS variables for badge
VariableDefault Core Theme Value
--badge__background-color--alerthex value: #e31c3d--color-error
--badge__background-color--infohex value: #0071bc--color-primary
--badge__background-color--successhex value: #12890e--color-success
--badge__background-color--warnhex value: #f8c41f--color-warn
--badge__font-colorhex value: #ffffff--color-white
--badge__font-color--alerthex value: #ffffff--color-white
--badge__font-color--infohex value: #ffffff--color-white
--badge__font-color--successhex value: #ffffff--color-white
--badge__font-color--warnhex value: #262626--color-base
--badge__background-colorhex value: #5a5a5a--color-gray-dark
--badge__border-radius--radius-pill

Guidance

When to use

  • To draw attention to new, important content on a page that might otherwise be missed.
  • To filter results with one or more tags.
  • To indicate the number of new or unread items within a container. For example, to indicate the number of unread messages within a person’s inbox.

When to consider alternatives

  • When users are likely to confuse a badge with a button. For example, when the badge appears in the same area of the page as buttons.
  • To call attention to new or updated content, consider changing the background color of the object itself or experiment with changing the font weight.
  • When users already expect content to be updated frequently. For example, on a site dedicated to breaking news. In this case placing the new content at the top may be enough.

Usage

  • Don’t overdo it — if everything on a page is called out as important, nothing is important.
  • Users may confuse badges as buttons. Always conduct usability testing to make sure your particular implementation is not causing frustration.
  • Don’t mix interactive and static badges on your site. Once you establish a pattern for how badges behave, users will expect that behavior every time.

Accessibility

Future research

  • Further usability testing should be done to ensure badges aren't being confused with buttons. Further iteration can be done with sizing and colors if there is confusion.

Component maturity

For more information about how we tested and validated our work for each checklist item, read our component maturity documentation.

Accessibility

  • Color

    Meets AA color contrast standards for accessibility and color blindness.
    Complete
  • Forced Colors Mode (FCM)

    While using FCM the components text is legible and improves readability.
    Complete
  • WCAG 2.1 Level AA Conformance

    All Axe checks for WCAG AA compliance have passed.
    Complete
  • Screen readers

    VoiceOver, NVDA, and JAWS screen readers provide concise communication and interaction.
    Complete
  • Keyboard navigation

    Component is fully navigable with a keyboard.
    Not applicable

Code

  • Storybook

    Component has stories to cover all defined props.
    Complete
  • Responsive

    Component designed to work in all responsive breakpoints.
    Complete
  • Spanish translations

    Includes Spanish translations for default text content.
    Complete

Tokens

  • Code

    Tokens implemented in code.
    Complete
  • Design

    Tokens implemented in the Sketch.
    Complete