Content
Badge
A small pill of words that states a status or a count, such as "Done" or "1 h 32 late"; people read it, they do not press it.
In kanso-ui as Badge
Accessibility
- A badge is text: no role, no tab stop. Put it after the title it describes, so it is read in that order.
- The words carry the meaning; the colour and the
aria-hiddenicon repeat it. - A count needs words for screen readers:
3<span class="k-sr"> left</span>. - A badge is not a live region; the action that changed it gives the feedback, such as a snackbar.
- Contrast, light / dark:
inkoncontainer14.3 / 12.0:1;on-accentonaccent7.6 / 7.7:1;on-accent-soft9.5 / 9.6:1;on-positive-soft10.9 / 10.3:1;on-caution-soft9.5 / 10.0:1;on-negative-soft10.8 / 11.2:1;on-critical-soft10.7 / 11.0:1;on-inkonink16.7 / 15.9:1. - Motion: none.