Badge component is used to highlight an item and attract attention or flag status, such as “New”, “Sale”, or other short phrases or a number to represent unread messages, updates available, etc..
Typical use cases include, but are not limited to, denoting a sale or new item, flagging an item as part of a category or representing a value of unread messages.
A badge should allow the following properties:
fill
, a string that maps to author defined variables.circular
, if circular styling is desired.
Component name:
fast-badge
Attributes:
fill
: stringcircular
: boolean
Slots:
default
Template:
<slot></slot>
fast-badge {
--badge-fill-primary: rgba(255, 0, 0, 1);
--badge-fill-secondary: #00FF00;
--badge-fill-transparent: transparent;
}
<fast-badge
fill="primary"
>
New
</fast-badge>
<fast-badge
fill="secondary"
circular=true
>
99
</fast-badge>
Ensure text meets WCAG 2.1 color contrast against background.
Badge should mirror in RTL languages, meaning the badge should flip to the other side of the item it is labeling.
No dependencies outside of fast-element itself.