Count prints a number on a slab pill: 14 px at weight 650 with tabular figures, at least 24 by 24 px, capped at "99+". Standalone it carries a label ("3 waiting") that screen readers read in place of the bare figure. On an IconButton (count) and at the end of an AvatarGroup it is decorative, because the control's name already says it.
Example#
Inbox 3 waiting Archive 140 archived
Usage#
Use a count for a number that changes and needs attention: unread messages, items waiting, results. It is a slab pill with tabular figures, capped at "99+".
- Standalone, it needs a
label("3 waiting") that screen readers read instead of the bare figure. - On a control, such as
IconButton countor the end of anAvatarGroup, it is decorative: the control's name already says it. - Zero usually means no count at all.
Anatomy#
Inbox 3 waiting Archive 140 archived
- PillThe slab, 24 px at least.
.mk-count - Figure14 px, weight 650, tabular.
.mk-count-figure
Volume#
Reading layer: identical at every volume.
Quiet
Inbox 3 waiting Archive 140 archived
Studio
Inbox 3 waiting Archive 140 archived
Press
Inbox 3 waiting Archive 140 archived
Rave
Inbox 3 waiting Archive 140 archived
Content#
- The label says what is counted: "3 waiting", "140 archived".
Do and don't#
Do
Inbox 3 waiting
Don't
Inbox 0 waiting
Accessibility#
- The figure is hidden from assistive tech when a
labelis given; the words are read instead. - Colour never carries the count's meaning: there is no red badge. The slab pill is the same on every look.
The colour pairs it prints, with their contrast on both papers:
| Text | Surface | Role | Bone | Night |
|---|---|---|---|---|
--mk-on-m | --mk-ink-m-solid | control-sm | 5.31:1 · Lc 79.9, passes | 4.53:1 · Lc 67.8, passes |
--mk-on-m | --mk-ink-m-hover | control-sm | 6.06:1 · Lc 83.1, passes | 5.10:1 · Lc 71.2, passes |
--mk-on-a | --mk-ink-a-solid | control-sm | 8.36:1 · Lc 60.1, passes | 10.43:1 · Lc 70.0, passes |
--mk-on-a | --mk-ink-a-hover | control-sm | 9.30:1 · Lc 65.2, passes | 11.51:1 · Lc 75.1, passes |
--mk-on-r | --mk-ink-r-solid | control-sm | 4.51:1 · Lc 75.7, passes | 8.53:1 · Lc 60.1, passes |
--mk-on-r | --mk-ink-r-hover | control-sm | 5.10:1 · Lc 79.6, passes | 9.56:1 · Lc 65.4, passes |
--mk-on-k | --mk-ink-k-solid | control-sm | 18.42:1 · Lc 107.1, passes | 16.21:1 · Lc 95.1, passes |
--mk-on-k | --mk-ink-k-hover | control-sm | 19.43:1 · Lc 107.6, passes | 17.71:1 · Lc 101.1, passes |
--mk-on-y | --mk-ink-y-solid | control-sm | 14.44:1 · Lc 89.2, passes | 14.76:1 · Lc 89.4, passes |
--mk-on-y | --mk-ink-y-hover | control-sm | 15.85:1 · Lc 94.9, passes | 16.20:1 · Lc 95.2, passes |
--mk-on-wood | --mk-ink-wood-solid | control-sm | 9.31:1 · Lc 64.8, passes | 4.54:1 · Lc 70.2, passes |
--mk-on-wood | --mk-ink-wood-hover | control-sm | 10.35:1 · Lc 70.1, passes | 5.18:1 · Lc 73.9, passes |
--mk-on-go | --mk-ink-go-solid | control-sm | 4.54:1 · Lc 76.3, passes | 10.08:1 · Lc 68.6, passes |
--mk-on-go | --mk-ink-go-hover | control-sm | 5.15:1 · Lc 80.3, passes | 11.15:1 · Lc 73.7, passes |
--mk-on-lead | --mk-ink-lead-solid | control-sm | 5.31:1 · Lc 79.9, passes | 4.53:1 · Lc 67.8, passes |
--mk-on-lead | --mk-ink-lead-hover | control-sm | 6.06:1 · Lc 83.1, passes | 5.10:1 · Lc 71.2, passes |
--mk-on-support | --mk-ink-support-solid | control-sm | 8.36:1 · Lc 60.1, passes | 10.43:1 · Lc 70.0, passes |
--mk-on-support | --mk-ink-support-hover | control-sm | 9.30:1 · Lc 65.2, passes | 11.51:1 · Lc 75.1, passes |
--mk-on-spot | --mk-ink-spot-solid | control-sm | 14.44:1 · Lc 89.2, passes | 14.76:1 · Lc 89.4, passes |
--mk-on-spot | --mk-ink-spot-hover | control-sm | 15.85:1 · Lc 94.9, passes | 16.20:1 · Lc 95.2, passes |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
value required | number | none | |
max | number | 99 | The cap; above it the pill prints "{max}+" (default 99). |
label | string | ((value: number) => string) | none | What the number means, read by screen readers: a string or a function of the value ("3 waiting"). |
prefix | string | none | A sign before the figure, e.g. "+" for AvatarGroup's overflow. |
decorative | boolean | none | Inside something that already says it: hidden from assistive tech. |
Tokens#
System tokens (8)
--mk-border--mk-font-text--mk-on-slab--mk-radius-pill--mk-slab--mk-surface--mk-text--mk-type-label-size
Its own properties (2)
--mk-count-leading--mk-count-pad
Changelog#
Arrived in 0.9.0.
Breadcrumbs,Pagination(withpaginationRange),Count,ProgressBar(bar, segments, indeterminate),AvatarandAvatarGroup,Tick,EmptyState,Kbd,SkeletonandLoader.IconButton'scountnow prints aCountat its corner. Read the whole entry