Skip to content
Hazine

Metric Card

Tile with a label, a headline value that counts up and a signed delta with a direction icon and a stated period. The default tile for a dashboard figure.

How it differs. The baseline tile: one value, one delta, one period. Direction is carried by sign, icon and hidden text together, with no chart and no comparison.

Install

pnpm dlx shadcn@latest add @hazine/metric-card

Adds 1 file, 1 shadcn primitive (card), 1 Hazine item (@hazine/animated-counter), 1 package (lucide-react), and the success token.

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": "https://api.hazine.dev/r/{name}.json"
  }
}

Needed once per project. Items resolve each other through the @hazine namespace.

Props6

labelrequired
string
Name of the metric. It labels the card for assistive technology.
valuerequired
number
delta
number
Signed change in percent against the period, for example 12.4 or -3.1.
period
string = "vs last 30 days"
Baseline the delta is measured against.
locale
string = "en-US"
formatOptions
Intl.NumberFormatOptions
Passed to Intl.NumberFormat for the value.

Also accepts every prop of React.ComponentProps<typeof Card>.

Accessibility

Pattern
Landmarks and headings
Keyboard
Nothing to operate. The item has no focusable parts.
Screen reader

A group labelled by the metric name. The delta is read as Up or Down followed by the signed percentage and the period.

Reduced motion
The value is shown at once and nothing counts.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies3

  • card
  • @hazine/animated-counter
  • lucide-react

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped2

  • --success
  • --success-foreground

Added to your stylesheet in light and dark, unless you already define them.

More in Data Display