Skip to main content

Badge
Ready

Badges are used to inform users of the status of an object or of an action that’s been taken.

Open in new window
<duet-badge>Default badge</duet-badge>
<duet-badge variation="warning">Warning badge</duet-badge>
<duet-badge variation="danger">Danger badge</duet-badge>
<duet-badge variation="success">Success badge</duet-badge>

Properties #

Property Attribute Description Type Default
margin margin Controls the margin of the component. "auto" | "none" "auto"
theme theme Theme of the badge. "" | "default" | "turva" ""
variation variation Style variation of the alert. "danger" | "default" | "success" | "warning" "default"

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • To give a status update on a piece of information or action.
  • Marking something as “recommended” or “requiring attention.”
  • When you want to highlight that an object has been recently added.
  • When you want to highlight e.g. offers.

When not to use #

  • Never make badges clickable. Instead use Button component’s small variation.

Variations #

This section describes the different component variations, their purpose, and when to use each variation.

Name Purpose
default Used to convey general information that isn’t critical. For example, you might show a status that tells that an item is “recommended.”
success Used to convey success states. For example, you might show a success status to indicate that changes were saved or something was completed.
danger Used to communicate problems that have to be resolved so that user can continue forward. This variation should be always used for e.g. highlighting errors.
warning Used to display badges that needs user’s attention and may require further steps.

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.



Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Abstract

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown

Tutorials

VS Code

Tutorials

Zeplin


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.