Skip to content

Design system

Documentation

DesignComponents / Statistic

Components / Statistic

Beta

Statistic

Present one named metric, with optional context, prefix, suffix, trend, or a loading placeholder.

On this page

Examples

Metric with trend

The metric stays readable as text; its direction label adds context without color-only meaning.

Monthly revenue
$48,250
Up8% over last month

Monthly revenue statistic

Loading metric

A bounded placeholder preserves the statistic layout while the feature waits for its value.

Active seats

Loading active seats statistic

Try the value

Change the fixture amount and loading state; formatting remains feature-owned.

Monthly revenue
$48,250
Up8% over last month

Statistic property playground

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

Component API
PropTypeDefaultDescriptionConstraints
title / valueReactNoderequiredNames and displays one feature-owned measure.Keep the title specific; pass a formatted value when the feature needs locale or currency formatting.
prefix / suffixReactNode—Optional context alongside the value.Keep units short and do not rely on a symbol alone when it may be ambiguous.
trend{ direction: up | down | neutral; label: ReactNode }—Displays a text direction and feature-provided comparison label.Direction is descriptive and does not imply whether the metric is good or bad.
loadingbooleanfalseReplaces value and trend with a decorative placeholder and sets aria-busy.The title stays visible; add a separate status announcement if the surrounding task needs one.
div props / aria-labelnative div props—Forwards ref, className, native attributes, and an optional accessible name override.The title names the group by default.

Tokens

Component tokens
TokenRoleEffective valueUsage
--type-size-xl / --type-weight-semiboldMetric valueShared type rolesKeeps metric emphasis consistent with the typography system.
--color-text-secondaryTitle and trendSemantic text roleKeeps supporting context subordinate to the value.

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

Do

Show a unit or comparison period when it changes how the value should be read.

Don’t

Encode success or failure solely from an upward or downward trend direction.

  • Progress shows the completion of one task.
  • Skeleton provides a content-shaped loading placeholder.
  • Table compares the records behind a metric.