Chapter 11 Data
Stat
One number with its label, and how it changed. The change is written out, with its sign or in words; the arrow and the colour only repeat it.
import { StatComponent } from '@okaapi-ui/angular';A row of stats
Tone is set apart from the arrow, because up is not always good: rising costs go up in red.
Revenue
EGP 84,200
+12% on last month
Costs
EGP 31,900
+8% on last month
Orders
1,204
Same as last month
<div class="grid grid-cols-[repeat(auto-fit,minmax(12rem,1fr))] gap-4">
<ui-card>
<ui-stat label="Revenue" value="EGP 84,200"
change="+12% on last month" trend="up" tone="positive" />
</ui-card>
<ui-card>
<ui-stat label="Costs" value="EGP 31,900"
change="+8% on last month" trend="up" tone="negative" />
</ui-card>
<ui-card>
<ui-stat label="Orders" value="1,204"
change="Same as last month" trend="flat" />
</ui-card>
</div>Number only
Open tickets
7
<ui-stat label="Open tickets" value="7" />In Arabic
الإيرادات
٨٤٬٢٠٠ جنيه
+١٢٪ عن الشهر الماضي
<ui-stat label="الإيرادات" value="٨٤٬٢٠٠ جنيه"
change="+١٢٪ عن الشهر الماضي" trend="up" tone="positive" />When to use something else
| If you need | Use |
|---|---|
| A level against a limit, such as 70% of storage | Meter |
| Several label and value pairs | Property list |
Inputs
| Name | Type | Default | What it does |
|---|---|---|---|
label | string | — | Required. What the number counts. |
value | string | — | Required. The number, already formatted with its unit. |
change | string | — | How it changed, readable on its own: "+12% on last month". |
trend | 'up' | 'down' | 'flat' | — | The arrow beside the change. |
tone | 'positive' | 'negative' | 'neutral' | 'neutral' | Green, red or grey for the change. Set it by meaning, not by direction. |
Keyboard and screen readers
- The change is written out, with its sign or in words; the arrow and colour only repeat it.