Indicator
A count, a status dot or a spinner on the corner of any element, such as a button, an icon or a card.
A count
Wrap the element in .indicator and add a span with data-count after it. It sits on the top right corner. Put the number in the element's aria-label too, because a screen reader reads the label of the button, not the count next to it.
<div class="stack" data-direction="row" data-gap="lg">
<span class="indicator">
<button type="button" class="btn" aria-label="Inbox, 3 unread">Inbox</button>
<span data-count>3</span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Notifications, 12 new"><i class="icon icon-bell" aria-hidden="true"></i></button>
<span data-count>12</span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Cart, 99+ items"><i class="icon icon-shopping-cart" aria-hidden="true"></i></button>
<span data-count>99+</span>
</span>
</div>
A status dot
Add a span with data-status (ok, warning, danger or info; neutral without a value). It sits on the bottom right corner. The dot is only colour, so give it role="img" and an aria-label that names the status.
<div class="stack" data-direction="row" data-gap="lg">
<span class="indicator">
<button type="button" class="btn" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status="ok" role="img" aria-label="Online"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status="warning" role="img" aria-label="Away"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status="danger" role="img" aria-label="Offline"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status role="img" aria-label="Unknown"></span>
</span>
</div>
Live
Add data-pulse to a dot for something that is
happening now: a ring spreads from the dot and fades. It stops
when the reader has asked for reduced motion, so name the state
in the aria-label as well, such as "Live now".
<div class="stack" data-direction="row" data-gap="lg">
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Camera"><i class="icon icon-video" aria-hidden="true"></i></button>
<span data-status="danger" data-pulse role="img" aria-label="Live now"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Microphone"><i class="icon icon-mic" aria-hidden="true"></i></button>
<span data-status="ok" data-pulse role="img" aria-label="Connected"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Network"><i class="icon icon-wifi" aria-hidden="true"></i></button>
<span data-status="warning" data-pulse role="img" aria-label="Reconnecting"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Broadcast"><i class="icon icon-radio" aria-hidden="true"></i></button>
<span data-status="info" data-pulse role="img" aria-label="Receiving"></span>
</span>
</div>
A loader
Put a Loader after the element to show
that it is working, such as a sync or a save. It sits on the
bottom right corner. Give it role="status" and an
aria-label that says what is happening.
<div class="stack" data-direction="row" data-gap="lg">
<span class="indicator">
<button type="button" class="btn" data-size="icon" aria-label="Cloud sync"><i class="icon icon-cloud" aria-hidden="true"></i></button>
<span class="loader" role="status" aria-label="Syncing"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Cloud sync"><i class="icon icon-cloud" aria-hidden="true"></i></button>
<span class="loader" role="status" aria-label="Syncing"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="primary" data-size="icon" aria-label="Cloud sync"><i class="icon icon-cloud" aria-hidden="true"></i></button>
<span class="loader" role="status" aria-label="Syncing"></span>
</span>
</div>
Sizes
Set data-size on .indicator:
sm or lg make the count and the dot
smaller or larger. Without it they are medium.
<div class="stack" data-direction="row" data-gap="lg">
<span class="indicator" data-size="sm">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Notifications, 4 new"><i class="icon icon-bell" aria-hidden="true"></i></button>
<span data-count>4</span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Notifications, 4 new"><i class="icon icon-bell" aria-hidden="true"></i></button>
<span data-count>4</span>
</span>
<span class="indicator" data-size="lg">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Notifications, 4 new"><i class="icon icon-bell" aria-hidden="true"></i></button>
<span data-count>4</span>
</span>
<span class="indicator" data-size="sm">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status="ok" role="img" aria-label="Online"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status="ok" role="img" aria-label="Online"></span>
</span>
<span class="indicator" data-size="lg">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Messages"><i class="icon icon-mail" aria-hidden="true"></i></button>
<span data-status="ok" role="img" aria-label="Online"></span>
</span>
<span class="indicator" data-size="sm">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Cloud sync"><i class="icon icon-cloud" aria-hidden="true"></i></button>
<span class="loader" role="status" aria-label="Syncing"></span>
</span>
<span class="indicator">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Cloud sync"><i class="icon icon-cloud" aria-hidden="true"></i></button>
<span class="loader" role="status" aria-label="Syncing"></span>
</span>
<span class="indicator" data-size="lg">
<button type="button" class="btn" data-variant="ghost" data-size="icon" aria-label="Cloud sync"><i class="icon icon-cloud" aria-hidden="true"></i></button>
<span class="loader" role="status" aria-label="Syncing"></span>
</span>
</div>
Colour and position
Put data-position on the mark to move it to top-left, top-right, bottom-left or bottom-right. A count takes data-variant for the colour of a status. For a person's photo or initials, the Avatar has its own count and dot.
<div class="stack" data-direction="row" data-gap="lg">
<span class="indicator">
<div class="card" style="padding: var(--space-4)">Order #1043</div>
<span data-count data-variant="danger" data-position="top-left">2</span>
</span>
<span class="indicator">
<div class="card" style="padding: var(--space-4)">Order #1044</div>
<span data-status="ok" data-position="top-right" role="img" aria-label="Paid"></span>
</span>
<span class="indicator">
<div class="card" style="padding: var(--space-4)">Order #1045</div>
<span data-count data-variant="info" data-position="bottom-left">New</span>
</span>
</div>
Attributes
| Attribute / element | Values | Description |
|---|---|---|
.indicator |
span |
Wraps the element and the mark. The mark is positioned on its corner. |
data-size |
sm lg |
On .indicator: the size of the count and the dot |
data-count |
on a child span |
A number or short text on the top right corner |
data-status |
ok warning danger info |
A dot on the bottom right corner. Neutral when empty. Add role="img" and an aria-label. |
data-pulse |
on a dot | A soft ring that spreads from the dot, for "live". Off under reduced motion. |
.loader |
on a child span |
A spinner on the bottom right corner. Add role="status" and an aria-label. |
data-variant |
ok warning danger info |
On a count: its colour |
data-position |
top-left top-right bottom-left bottom-right |
On the mark: which corner it sits on |