Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

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.

Use it in Angular
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

Angular
<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

Angular
<ui-stat label="Open tickets" value="7" />

In Arabic

الإيرادات

٨٤٬٢٠٠ جنيه

+١٢٪ عن الشهر الماضي

Angular
<ui-stat label="الإيرادات" value="٨٤٬٢٠٠ جنيه"
  change="+١٢٪ عن الشهر الماضي" trend="up" tone="positive" />

When to use something else

If you needUse
A level against a limit, such as 70% of storageMeter
Several label and value pairsProperty list

Inputs

NameTypeDefaultWhat it does
labelstring — Required. What the number counts.
valuestring — Required. The number, already formatted with its unit.
changestring — 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.