Examples
Metric with trend
The metric stays readable as text; its direction label adds context without color-only meaning.
Monthly revenue statistic
import { Statistic } from "@phuctech/ui/components/statistic";
export function Example() {
return (
<Statistic
title="Monthly revenue"
value="$48,250"
trend={{ direction: "up", label: "8% over last month" }}
/>
);
}
Loading metric
A bounded placeholder preserves the statistic layout while the feature waits for its value.
Loading active seats statistic
import { Statistic } from "@phuctech/ui/components/statistic";
export function Example() {
return <Statistic title="Active seats" value="1,248" suffix="seats" loading />;
}
Try the value
Change the fixture amount and loading state; formatting remains feature-owned.
Statistic property playground
import { Statistic } from "@phuctech/ui/components/statistic";
export function Example() {
return (
<Statistic
title="Monthly revenue"
value={"$48,250"}
trend={{ direction: "up", label: "8% over last month" }}
loading={false}
/>
);
}
When to use
Use Statistic for a small group of named measures in a dashboard. Keep number formatting, aggregation, thresholds, and business meaning in the feature that owns the data.
Usage
import { Statistic } from "@phuctech/ui/components/statistic";
<Statistic title="Monthly revenue" value="$48,250" trend={{ direction: "up", label: "8% over last month" }} />API
Tokens
Accessibility
The title labels the statistic group by default. During loading, the title remains available while the visual placeholders are hidden from assistive technology; add a feature-owned status when people need an explicit loading announcement.
Do and don’t
Show a unit or comparison period when it changes how the value should be read.
Encode success or failure solely from an upward or downward trend direction.