Display one dashboard metric and an optional change; the application supplies the data and calculates comparisons.

How to use

Arrange multiple MetricCard components for a dashboard; use Card for general content. The caller provides values and comparisons. Use emphasis to select the primary value and trend to describe its direction.

Card is the actual host. Callers own layout and formatted values. Empty values display "-", real zero remains visible, and omitting change removes its region. The default background is Background/3, configurable through --snowui-metric-card-background-override. With emphasis="change", change is on the left and the current value on the right. Include a sign or text to convey direction without color alone. MetricCard does not fetch data or calculate comparisons and supports SSR.

Import

import { MetricCard } from '@snowui-design-system/components';

Usage

Emphasis

API Reference

Property Type Default Example Description
label string required label="Example" The name of the metric displayed above its values.
value string required value="Example" The current value, already formatted by the caller.
change string — change="Example" An optional formatted change; without it the current value is primary.
emphasis 'value' | 'change' "change" emphasis="value" Choose whether the current value or the change is visually primary.
trend 'positive' | 'negative' | 'neutral' "neutral" trend="positive" Style the initial change sign as positive, negative, or neutral; the caller determines its meaning.
No data