Stat & Metric
A key number with its trend: Metric card for dashboards, KPI stat for compact tiles, and the gauge for a value against a known range.
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add metricAlso works with shadcn:
npx shadcn@latest add @ritla/metricDependencies it brings
@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { MetricItem, MetricCard, MetricBars } from "@/components/ui/metric";<MetricItem label="Transfers this month" value="1,284" trend={{ value: "12%", direction: "up" }} /><MetricCard title="Card spending" value="1,240" trend={{ value: "25%", direction: "up" }} period="vs last month" chart={<MetricBars data={[25, 50, 100, 75, 50, 10]} />} />Examples
Metric card
Bars beside the number, a progress bar above it, or a small gauge. The bars keep running left to right in Arabic; progress fills from the inline start.
KPI stat types
type picks Figma's layout: an icon in a square, a mini chart beside or under the number, or a title band. The footer is a settings button and a View report button.
Gauge
One value against a known range with good and bad zones. scale says which end is good. In Arabic the dial mirrors, so the scale runs from the right.
Color follows meaning
More failed payments is bad news: the arrow points up, and the tag and the line are red (tone: "negative").
API reference
MetricItem
| Prop | Type | Default | Description |
|---|---|---|---|
type | "simple" | "icon-01" … "icon-04" | "chart-01" … "chart-04" | "simple" | Figma's Type: the tile's layout. |
label | ReactNode | None | The metric and its period (“Views in 24 hours”). |
value | ReactNode | None | The number, formatted with its unit. |
trend | { value, direction: "up" | "down", tone? } | None | The change. tone says whether it is good news (green) or bad (red), by meaning, not direction. |
period | ReactNode | None | The comparison after the trend (“vs last month”). |
icon | IconComponent | None | The holder's icon in the Icon types and Chart 02. |
iconColor | "brand" | "green" | "red" | "amber" | "gray" | "brand" | The circle's color in Icon 01 and 02. |
chart | number[] | None | The mini chart's values in time order, oldest first. |
chartLabel | string | None | A text summary of the chart; without one it is hidden from screen readers. |
menu | ReactNode | None | An icon button opening a Menu, at the top inline end. |
footer | ReactNode | None | Figma's Actions: a link or buttons in the footer. |
MetricCard
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | None | The metric and its period. |
value / trend / period | … | None | As in MetricItem; the trend is a tag here. |
type | "bar-chart" | "progress" | "bar-chart" | Figma's Type: the chart beside the number, or a progress bar above it. |
chart | ReactNode | None | MetricBars, MetricProgress or MetricGauge size="sm". |
menu / footer | ReactNode | None | The menu button, and the footer (usually a See details link). |
footerContent | ReactNode | None | The footer's Figma Slot: content at its inline start, before the link (a last-updated time, a legend, a status). |
MetricBars / MetricSparkline / MetricProgress
| Prop | Type | Default | Description |
|---|---|---|---|
data | number[] | None | The values in time order (two to six bars). |
highlight | number | None | The strong bar; the highest by default. |
size | "sm" | "md" | "lg" | "lg" | The bars' size: 12, 16 or 24px wide. |
value / max / label | number, number, string | None | In MetricProgress: progress toward a goal, a named meter. |
MetricGauge
| Prop | Type | Default | Description |
|---|---|---|---|
value / min / max | number | None | The value and its known range. |
scale | "high-is-good" | "low-is-good" | "high-is-good" | Figma's Scale: which end is good, which orders the red and green zones. |
size | "md" | "sm" | "md" | md with the value, label and scale ends; sm the dial alone, inside a card. |
label | string | None | What it measures, printed under the value; the meter's name. |
valueText / minText / maxText | ReactNode | None | The value and the scale ends as printed. |
Usage guidelines
A metric shows one number with its label. Which type, label and value, trends and their colors, mini charts and gauges, dashboard layout, what mirrors in Arabic and what doesn't, and the checks before handoff.
1. KPI stat, Metric card or Gauge
All three show one number with its label. Pick by how much context the number needs. For many numbers side by side, use a table; for exact values over time, use a chart.
| You need to | Use | Why |
|---|---|---|
| Show a row of key numbers on a dashboard | KPI stat (KPI tile in fintech) | Compact tile with a trend and an optional sparkline. |
| Show a number with its recent shape or progress to a goal | Metric card | Bar chart or Progress under the value, with a link to details. |
| Show one value against a known range with good and bad zones | Gauge metric, or Radial chart | The dial shows at once whether the value is healthy. Use Radial chart when there are no good and bad zones. |
| Compare many numbers across records | Table | Columns line numbers up for comparison. |
| Read exact values over time | Chart | Axes, labels and tooltips give the detail. |
2. Label and value
The label names the metric and its period. The value uses the product's number format: grouping separators, the currency or unit, and only the decimals people need. Abbreviate large numbers the same way everywhere.
A value people can read
A wallet dashboard tile.
Do
- Name the metric and the period: Transfers this month.
- Show the unit or currency with the value.
- Round to what people act on: 1,284, not 1,284.372.
- Abbreviate the same way on every tile: 1.2M, 840K.
Don't
- Use vague labels such as Total or Data.
- Leave out the period, so people can't tell what the number covers.
- Mix 1.2M and 1,200,000 on one dashboard.
3. Trends and their colors
A trend tag shows the change and what it compares to. Its color says whether the change is good, not which way it went: more revenue is Success, more failed payments is Error. The arrow shows the direction.
Color follows meaning
Failed payments went up 8%.
Do
- Always say what the change compares to: vs last month.
- Color by meaning: Success for good, Error for bad, Gray for neutral.
- Keep the arrow, so the direction doesn't rely on color.
- Show the same comparison period on every tile in a row.
Don't
- Make every increase green.
- Show a percentage without a baseline.
- Use color alone to show up or down.
4. Mini charts and gauges
Mini charts in KPI stat and Metric card show the shape of a trend, not exact values: no axes, no labels. A gauge needs a known range and zones. Set Scale to Low is good or High is good, and label the minimum, the maximum and the value.
Do
- Use mini charts for shape; link to the full chart for detail.
- Use a gauge only when the range and the healthy zone are known.
- Set the gauge Scale to match whether low or high is good.
- Print the value and its unit under the gauge.
Don't
- Add axes or tooltips to a mini chart.
- Use a gauge for a value with no upper limit.
- Rely on the red and green zones alone.
5. Dashboard layout
Put metrics in a row at the top of a dashboard, most important first, at the inline start. Use one Type per row so values line up. On phones, use Breakpoint=Mobile and stack tiles or show two per row.
Do
- Show three or four metrics in a row.
- Put the most important metric first.
- Use one Type and one comparison period per row.
- Switch to Breakpoint=Mobile on phones.
Don't
- Fill a row with eight tiles of equal weight.
- Mix types in one row.
- Truncate values to make tiles fit.
6. Arabic and RTL
Use the RTL variant in Arabic. The label, value and trend move to the right and the menu to the left. Gauges mirror, so 0 sits on the right. Mini charts and trend arrows don't mirror: time runs left to right. Numbers use Western digits unless the product switches to Arabic-Indic.
The layout mirrors, the chart doesn't
The transfers tile in Arabic.
Before handoff
- Every label names the metric and the period.
- Values share one format, unit and rounding.
- Trend colors follow meaning, with a baseline.
- Gauges have a range, a Scale and a printed value.
- Arabic tiles use the RTL variant; charts don't mirror.
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | Only to the menu button and the footer's link and buttons; numbers and charts aren't interactive. |
ARIA
- The trend is read in words (“Up 25%”) and the arrow is hidden, so color and the arrow are never the only signal.
- Mini charts are hidden from screen readers because the tile says the number; pass
labelto give one a summary. - The gauge and the progress bar are
meters with a minimum, maximum and value. - The menu button names its metric (“Transfers this month options”).
Do
- The label, value and trend are read together, in order.
- Read the trend in words: up 12% from last month.
- Give a mini chart a text summary, or hide it if the tile already says it.
- Mark a gauge as a meter with its minimum, maximum and current value.
- Trend and value text at 4.5:1 contrast.
Don't
- Announce the arrow icon as an image.
- Rely on red and green to tell good from bad.
Arabic and RTL notes
Mirrors
- The label, value and trend sit on the right; the menu on the left.
- The gauge's dial mirrors and runs from the right.
- The progress bar fills from the inline start, the right.
Does not mirror
- Mini charts and bars: time runs left to right.
- Trend arrows.
- Numbers and percentages read left to right.
- Numerals
- Numbers are as you pass them; format them with
formatNumberso they follow the product's numerals, the same way on every tile. - Arabic typography
- Value
heading-28Semibold in the item andheading-42Medium in the card; labelbody-14orbody-16; trendbody-14Medium. - Mixed-direction text
- The value and percentage are isolated LTR, so the percent sign and separators don't reorder inside Arabic text.
Do
- The RTL variant for every tile in an Arabic dashboard.
- Mirror gauges; keep mini charts and trend arrows unmirrored.
- Values left to right, with the same number format as English.
- Write Arabic labels natively, not translated.
Don't
- Arabic text in the English variant.
- Flip a chart so time runs right to left.
- Mix Western and Arabic-Indic digits on one screen.