Skip to content

Count

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>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/count.css";

Usage

<span class="cap-count" data-tone="need">3</span>
@import "capsomer/count.css";

API reference

Parts and data attributes

ClassIs
.cap-countthe root
AttributeValues
data-tonecrit need warn
StateRead 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.