Skip to content

Data

Metrics

The same four primitives render finance, SaaS and infrastructure numbers. Nothing in this layer knows what Bitcoin is.

Examples

import { Button, Delta, FreshnessBadge, Metric, MetricValue, StatCard } from "@luc/ui";

StatCard

Label, value, delta, optional visual and footer. Values animate to their new state without moving anything around them.

Revenue
$128,431+12.4%vs 30d
Live · 42s ago·Billing
BTC price
$109,241.42+2.1%24h
Coinbase · 1d close
Rows ingestedclickhouse
48.3M+4.2%24h
P95 latency
27.4 ms-8.1%vs 24h
edge-eu-west

Metric block

For headers and dense rows where a full card would be too heavy.

Sharpe ratio+0.18
1.42
Max drawdown-2.4%
-11.8%
Portfolio valuelive
$1,284,310
Updated Live · 8s ago

Value sizes

$128,431$128,431$128,431$128,431

Delta

Direction is carried by colour and a glyph. Invert it when down is good — latency, error rate, drawdown.

Up

+12.4%

Down

-11.8%

Inverted (lower is better)

-8.1%

Neutral

0.0%

Absolute

+0.18

Missing data

—

Formatting

Every numeric formatter is guarded: a missing value renders an em dash, never “NaN”.

Kinds

number128,431
decimal27.40
percent12.4%
currency$109,241
compact48.3M
missing—

Why tabular figures matter

$128,431$128,977$129,140

The width is reserved by an invisible copy of the formatted result, so the layout is identical before, during and after the ticker runs.

API

Component props
PropTypeDefaultNotes
StatCard label / valueReactNode / number | null—The two required slots.
StatCard delta / invertDeltanumber / boolean—Rendered through Delta; invert when down is good.
StatCard visual / footerReactNode—Chart slot and provenance line.
MetricValue size"sm" | "md" | "lg" | "xl""lg"Value scale; xl for headline metrics.
MetricValue animatebooleantrueUses NumberTicker; set false for static exports.
Delta variant"percent" | "absolute""percent"Percent is signed and one decimal by default.

Rules

Do

  • Always state the comparison window next to a delta.
  • Use the same size for values that sit in the same grid.
  • Show freshness where a number could be stale.

Don't

  • Colour a metric value itself — keep colour on the delta.
  • Use a sparkline without a labelled range.
  • Mix xl values with sm values in one row.

Usage

import { Metric } from "@luc/ui/data";
<Metric label="Net exposure" value={0.62} kind="percent" delta={0.04} />

Guidelines

Do

  • Use `Metric` for a figure that stands alone, and `StatCard` when the figure needs an icon, a footer or its own selectable surface.
  • Pass `kind`, `currency` and the fraction digits instead of a pre-formatted string, so the figure and its delta are formatted by one rule.

Don't

  • Animate a figure that changes every frame; `animate` is for a value that arrives once.

Accessibility

The label and the value are text in reading order, and the numeric part uses tabular figures so a changing value does not move its neighbours. The delta keeps its sign in text.

Luc UI v1.0Metricdark theme