GitHubGitHub
← All widgets
Analytics / widget

KPI card

A metric card for values, units, comparison, trend, target bands, period context, and health state.

NormalWarningCriticalStaleLoadingNo data

Throughput

normal
428.6req/s
↑ 6.4%

Success rate

warning
94.2%
Target↔ 96 %
↓ 1.2%

Storage

normal
<KpiCard label="Success rate" value={94.2} unit="%" target={96} thresholds={bands} points={trend} />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { KpiCard } from '@chanrg/4ui';<KpiCard label="Success rate" value={94.2} unit="%" target={96} thresholds={bands} points={trend} />

API reference

Props

PropTypeDefaultDescription
valuenumber | string | nullnullAlready normalized KPI value.
statusHealthStatusnormalSemantic state.
targetnumber | nullnullObjective marker.
thresholdsKpiThresholds{}Warning and critical range boundaries.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Status is always rendered as text.
  • Numerals use tabular figures.
  • Target and current values are represented on a labelled semantic band.

Dependencies

Sparkline, Skeleton, internal KpiRangeBar