A count in a small round bubble, toned by what the number means, for a tab, row or icon.
<div class="cap-specimen-row" id="b-tones">
<span>Queue <span class="cap-count">12</span></span>
<span>Needs you <span class="cap-count" data-tone="need">3</span></span>
<span>Failing <span class="cap-count" data-tone="crit">2</span></span>
<span>Slow <span class="cap-count" data-tone="warn">5</span></span>
<span>Past 99 <span class="cap-count" data-tone="need">99+</span></span>
</div>
Copy
View code
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/count.css";Copy
Usage
<span class="cap-count" data-tone="need">3</span>Copy
@import "capsomer/count.css";Copy
API reference
Parts and data attributes Class Is .cap-countthe root
Attribute Values data-tonecrit need warn
State Read from :emptythe platform
Accessibility
Nothing to operate.
The count's text is the number. Where a count sits on an icon, the control's name carries the count too ("Inbox, 3 unread"), and the count itself is aria-hidden. Every tone reaches 4.5:1 in both themes. Under forced colors the bubble gets an edge.