Badge Ready
Badges are used to inform users of the status of an object or of an action that’s been taken.
Examples #
<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>
<duet-badge variation="subtle">Subtle badge</duet-badge>
<duet-badge background="strong">Default badge</duet-badge>
<duet-badge background="strong" variation="warning">Warning badge</duet-badge>
<duet-badge background="strong" variation="danger">Danger badge</duet-badge>
<duet-badge background="strong" variation="success">Success badge</duet-badge>
<duet-badge background="strong" variation="subtle">Subtle badge</duet-badge>
Properties #
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
background | background | Variation of the background. "strong" results in a more prominent background color. | "normal" | "strong" | "normal" |
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 badge. | "danger" | "default" | "subtle" | "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. |
subtle | Usage similar to default, with de-emphasized appearance for situations, where default could create visual clutter or incorrectly give clicking affordance. |
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.
- Badge is a normal div element with text inside which doesn’t have any added functionality for assistive technologies.
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:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.