Metric Box

The Metric Box component displays key metrics in a card-style component, supporting content like icons and subtext.

Usage

Default

Users Online

1,234
<MetricBox title="Users Online" value="1,234" theme="primary" align="center" size="medium" />

Props

Data table
TypeDescription
align"left" | "right" | "center"Text alignment for content. One of: "left" | "center" | "right"
aria-atomicbooleanWhether assistive tech should present the live region as a whole.
aria-describedbystringCustom accessible description reference for the whole metric box. Overrides the internal subtext description when provided.
aria-labelstringCustom accessible label for the whole metric box. Use when the title/value pairing needs a more descriptive spoken label.
aria-labelledbystringCustom accessible label reference for the whole metric box. Overrides the internal title-based labelling when provided.
aria-live"off" | "polite" | "assertive"Live region setting for announcing metric value updates. Useful for dynamic dashboards.
classNamestringOptional additional CSS class names for custom styling.
data-testidstringOptional test ID for testing frameworks.
decorativeIconbooleanWhether the icon is decorative. Defaults to true.
iconIconTypeOptional icon to visually represent the metric (from react-icons, for example).
iconAriaLabelstringAccessible label for the icon when it is not decorative.
outlinebooleanOptional outline style for the component (default: false).
roleReact.AriaRoleAccessible role for the wrapper. Defaults to "region" when a title is present.
roundingRoundingTypeRounding style for the component. One of: "none" | "small" | "medium" | "large" | "full"
shadowShadowTypeShadow style for the component. One of: "none" | "light" | "medium" | "strong" | "intense"
sizeSizeTypeSize of the component. One of: "xs" | "small" | "medium" | "large" | "xl"
stateStateTypeState of the metric. One of: "success" | "error" | "warning" | "disabled" | ""
subtextstringOptional subtext providing additional context for the metric.
themeThemeTypeTheme to apply for styling. One of: "primary" | "secondary" | "tertiary" | "quaternary" | "clear"
titlestringTitle of the metric.
valuestring | numberThe primary value of the metric, e.g., a number or a string.