Metric

Displays a numeric reading with tabular figures and aligned units.

Estimated range

386km

Estimated range

386km

Ready for your next journey

18 km more than yesterday

Use it for

  • Dashboard readings, vehicle status, and concise numeric comparisons.

Not for

  • Full data series; use Charts.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { Metric } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/metric.

2. Vendor the source

npx @noorddev/vlak-cli add metric

The StyleX leaf lands in components/vlak/, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/metric.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { Metric } from "@noorddev/vlak-react";

<Metric label="Estimated range" value={386} unit="km" description="Ready for your next journey" comparison="18 km more than yesterday" />

Metric

A numeric reading with stable baseline, tabular figures, and an explicit unit.

PropTypeDefaultDescription
labelrequiredReactNode
valuerequiredstring | number
unitReactNode
descriptionReactNode
comparisonReactNode
trendReactNodeOptional trend visualization, for example an existing Sparkline.
localestring"en"
formatOptionsIntl.NumberFormatOptions

Also accepts Omit<HTMLAttributes<HTMLDivElement>, "children">.

KeysDoes
NoneStatic reading; no additional keyboard stop.
<div class="rs-metric"><p class="rs-metric-label">Estimated range</p><div class="rs-metric-reading"><span class="rs-metric-value">386</span><span class="rs-metric-unit">km</span></div></div>
.rs-metric.rs-metric-label.rs-metric-reading.rs-metric-value.rs-metric-unit.rs-metric-detail