Surfaces and display
Stat tile
One number with its name, its change against a named period, and optionally a small line of its history. .kui-stat on its own, or several in .kui-stats.
The sparkline is a <kui-chart type="sparkline"> from the charts kit. It draws the line from a table that stays in the page for screen readers.
Examples
A row of tiles with trends and sparklines
The arrow and the sign say the direction; the colour says whether the change is good. More cases is good, more overdue invoices is bad, so both rise and one is red.
| Month | Value |
|---|---|
| Jun | 880000 |
| Jul | 910000 |
| Aug | 640000 |
| Sep | 1020000 |
| Oct | 1071000 |
| Nov | 1204300 |
| Month | Value |
|---|---|
| Jun | 17 |
| Jul | 18 |
| Aug | 18 |
| Sep | 20 |
| Oct | 21 |
| Nov | 24 |
| Month | Value |
|---|---|
| Jun | 3 |
| Jul | 4 |
| Aug | 6 |
| Sep | 4 |
| Oct | 5 |
| Nov | 7 |
<div class="kui-stats">
<div class="kui-stat">
<span class="kui-stat__label">Billed in November</span>
<span class="kui-stat__value">1 204 300 <small>RSD</small></span>
<div class="kui-stat__foot"><span class="kui-trend kui-trend--good"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#trending-up"></use></svg><span class="kui-visually-hidden">Up</span>+12,4 %</span><span>against October</span></div>
<kui-chart type="sparkline" class="kui-stat__spark" height="40">
<table>
<caption>Billed per month, RSD</caption>
<thead><tr><th>Month</th><th>Value</th></tr></thead>
<tbody><tr><th scope="row">Jun</th><td>880000</td></tr><tr><th scope="row">Jul</th><td>910000</td></tr><tr><th scope="row">Aug</th><td>640000</td></tr><tr><th scope="row">Sep</th><td>1020000</td></tr><tr><th scope="row">Oct</th><td>1071000</td></tr><tr><th scope="row">Nov</th><td>1204300</td></tr></tbody>
</table>
</kui-chart>
</div>
<div class="kui-stat">
<span class="kui-stat__label">Open cases</span>
<span class="kui-stat__value">24</span>
<div class="kui-stat__foot"><span class="kui-trend kui-trend--good"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#trending-up"></use></svg><span class="kui-visually-hidden">Up</span>+3</span><span>this month</span></div>
<kui-chart type="sparkline" class="kui-stat__spark" height="40">
<table>
<caption>Open cases per month</caption>
<thead><tr><th>Month</th><th>Value</th></tr></thead>
<tbody><tr><th scope="row">Jun</th><td>17</td></tr><tr><th scope="row">Jul</th><td>18</td></tr><tr><th scope="row">Aug</th><td>18</td></tr><tr><th scope="row">Sep</th><td>20</td></tr><tr><th scope="row">Oct</th><td>21</td></tr><tr><th scope="row">Nov</th><td>24</td></tr></tbody>
</table>
</kui-chart>
</div>
<div class="kui-stat">
<span class="kui-stat__label">Overdue invoices</span>
<span class="kui-stat__value">7</span>
<div class="kui-stat__foot"><span class="kui-trend kui-trend--bad"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#trending-up"></use></svg><span class="kui-visually-hidden">Up</span>+2</span><span>against October</span></div>
<kui-chart type="sparkline" class="kui-stat__spark" height="40">
<table>
<caption>Overdue invoices per month</caption>
<thead><tr><th>Month</th><th>Value</th></tr></thead>
<tbody><tr><th scope="row">Jun</th><td>3</td></tr><tr><th scope="row">Jul</th><td>4</td></tr><tr><th scope="row">Aug</th><td>6</td></tr><tr><th scope="row">Sep</th><td>4</td></tr><tr><th scope="row">Oct</th><td>5</td></tr><tr><th scope="row">Nov</th><td>7</td></tr></tbody>
</table>
</kui-chart>
</div>
</div>
Without a chart
A tile can be only the label and the value. A falling number that is good is green with a downward arrow.
<div class="kui-stats">
<div class="kui-stat"><span class="kui-stat__label">Average time to payment</span><span class="kui-stat__value">18 <small>days</small></span><div class="kui-stat__foot"><span class="kui-trend kui-trend--good"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#trending-down"></use></svg><span class="kui-visually-hidden">Down</span>−4 days</span><span>against 2025</span></div></div>
<div class="kui-stat"><span class="kui-stat__label">Klijenti</span><span class="kui-stat__value">312</span><div class="kui-stat__foot"><span class="kui-trend"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#minus"></use></svg><span class="kui-visually-hidden">No change</span>0</span><span>this week</span></div></div>
<div class="kui-stat"><span class="kui-stat__label">Durchschnittliche Bearbeitungszeit</span><span class="kui-stat__value">2,5 <small>h</small></span></div>
</div>
States
Every state
Neutral trend: muted, for no change. Loading: skeletons in place of the value, with aria-busy on the tile. No data yet: a dash and words that say why. A very large value keeps tabular figures and wraps its unit if it must.
<div class="kui-stats">
<div class="kui-stat" aria-busy="true"><span class="kui-stat__label">Loading</span><span class="kui-skeleton kui-skeleton--title" aria-hidden="true"></span><span class="kui-skeleton kui-skeleton--text" style="width: 60%" aria-hidden="true"></span><span class="kui-visually-hidden">Loading the value</span></div>
<div class="kui-stat"><span class="kui-stat__label">No data yet</span><span class="kui-stat__value" aria-label="No value">–</span><div class="kui-stat__foot"><span>The first invoice is counted when it is sent.</span></div></div>
<div class="kui-stat"><span class="kui-stat__label">Large</span><span class="kui-stat__value">128 450 912 <small>RSD</small></span><div class="kui-stat__foot"><span class="kui-trend kui-trend--bad"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#trending-down"></use></svg><span class="kui-visually-hidden">Down</span>−0,8 %</span><span>year on year</span></div></div>
</div>
Classes and attributes
.kui-stat- The tile.
.kui-stat__label, .kui-stat__value- The name and the number. A
<small>in the value holds the unit. .kui-stat__foot- The trend and the period it compares with.
.kui-trend, --good, --bad- The change: an arrow icon, hidden words for its direction, the signed amount. The modifier colours it.
kui-chart.kui-stat__spark[type="sparkline"]- The small history line; height in pixels. Needs the charts kit.
.kui-stats- A grid of tiles that wraps.
Accessibility
- Write the direction in words (“Up”, “Down”) as visually hidden text; the arrow is aria-hidden and colour alone says nothing to some people.
- Name the period the change compares with, next to it.
- The sparkline’s table stays in the page for screen readers, with its caption as the name.
- Use tabular figures (the tile does), so numbers in a row line up.
Do and do not
Do
- Choose good or bad by what the number means, not by its direction.
- Round to what a person needs: 1,2 mil., not 1 204 312,47.
- Show at most four tiles in a row.
Do not
- Do not show a trend without the period.
- Do not use red only because a number went down.
- Do not put a full chart in a tile; link to it.