MetricsCard
FiddlePage views48.2k+12% vs last 30 days
Usage
The import, then a use to start from. Both copy as they are.
Import
import { MetricsCard } from "@/components/web-analytics/MetricsCard";Example
<MetricsCard title="Page views" value={48200} isLoading={isLoading} error={error} change={{ label: "+12%", direction: "up", tone: "positive", description: "43,100 in the previous 30 days" }}/>When to use
Use it for
- One number per tile, with its title and how it moved against the previous period.
value={null}with anemptyLabelwhen there's no number to show;suffixfor a unit such as%.isRefreshingdims the old number while a new range loads, instead of blanking it.
Avoid
- A comparison that isn't fair: leave
changeout rather than show it. - Several numbers in one tile. Give each its own.
Accessibility
Checks
change.descriptionis read with the label, so the comparison makes sense without the color.
API
Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.
MetricsCard
Its stories don't declare
argTypes, so no props are listed. The variants show its states.VariantsDefaultPercentageEmptyWithChangeNegativeChangeNeutralChangeRefreshingLoadingErrorState