Badge
<wa-badge>
Badges draw attention to adjacent content by displaying a status, count, or label. This subclass adds the Yoummday badge palette and sizing to Web Awesome's badge behavior.
Examples
Variant
Set the variant attribute to change the badge's variant.
Appearance
Use the appearance attribute to change the badge's visual appearance.
Size
Badges are sized relative to the current font size. You can set font-size on any badge (or an ancestor element) to change it.
Pill
Use the pill attribute to give badges rounded edges.
Drawing Attention
Use the attention attribute to draw attention to the badge with a subtle animation. Supported effects are bounce, pulse and none.
Set the --pulse-color custom property to color the pulse independently of the badge's variant.
Start & End Decorations
Use the start and end slots to add presentational elements like <wa-icon> alongside the badge's label.
With Buttons
One of the most common use cases for badges is attaching them to buttons. To make this easier, badges will be automatically positioned at the top-right when they're a child of a button.
Yoummday Extensions
The Yoummday badge extends Web Awesome's variants with additional product colors and an indicator gradient. It also uses compact, token-based sizing across all variants.
Yoummday Variants
Use the additional Yoummday variants when a badge needs one of the established product colors.
Indicator
Use variant="indicator" to display a gradient status. Set --indicator-percent from 0% to 100% to control the
gradient position.
Yoummday Sizing
Unlike the upstream badge's relative sizing, the Yoummday badge uses the design-system tokens for extra-small text,
normal line height, compact padding, and a small border radius. Icons in the start and end slots use the large font
size token.
API
Importing
If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.
Import this component directly from the CDN:
import 'https://cdn.yoummday.com/packages/@yoummday/webawesome/0.5.1/dist/components/badge/badge.js';
After installing Web Awesome via npm, import this component:
import '@yoummday/webawesome/dist/components/badge/badge.js';
If you're self-hosting Web Awesome, import this component from your server:
import './webawesome/dist/components/badge/badge.js';
To import this component for React 18 or below, use the following code:
import YoummdayBadge from '@yoummday/webawesome/dist/react/badge/index.js';
Slots
Learn more about using slots.
| Name | Description |
|---|---|
| (default) | The badge's content. |
end
|
An element, such as <wa-icon>, placed after the label. |
start
|
An element, such as <wa-icon>, placed before the label. |
Attributes & Properties
Learn more about attributes and properties.
| Name | Description | Reflects |
|---|---|---|
appearanceappearance |
The badge's visual appearance.
Type
'accent' | 'filled' | 'outlined' | 'filled-outlined'
Default
'accent'
|
|
attentionattention |
Adds an animation to draw attention to the badge.
Type
'none' | 'pulse' | 'bounce'
Default
'none'
|
|
pillpill |
Draws a pill-style badge with rounded edges.
Type
boolean
Default
false
|
|
variantvariant |
The badge's theme variant. Defaults to
brand if not within another element with a variant.
Type
'brand' | 'neutral' | 'success' | 'warning' | 'danger'
Default
'brand'
|
|
CSS Custom Properties
Learn more about CSS custom properties.
| Name | Description |
|---|---|
--indicator-percent |
The gradient position when using
variant="indicator". |
--pulse-color |
The color of the badge's pulse effect when using
attention="pulse". |
CSS Parts
Learn more about CSS parts.
| Name | Description | CSS selector |
|---|---|---|
badge |
The component's outer wrapper. |
::part(badge)
|
end |
The container that wraps the end slot. |
::part(end)
|
start |
The container that wraps the start slot. |
::part(start)
|
base |
Deprecated. Use the badge part instead. |
::part(base)
|