# Stat Card

> A metric that tells its own story.

The number counts up, the sparkline draws left to right, and change is marked by arrow and sign, not colour alone.

- Family: Cards
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/stat-card/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add stat-card
```

It installs to `components/galactrex/stat-card.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { StatCard } from "@/components/galactrex/stat-card";

<StatCard label="Downloads" value={48210} change={12.4} trend={[3, 5, 4, 8, 9]} />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — | Metric. |
| `value` | `number` | — | Value. |
| `format / locale` | `Intl options` | — | Formatting. |
| `change` | `number` | — | Percent change. |
| `trend` | `number[]` | — | Sparkline values. |
| `period` | `string` | — | Comparison period. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Revenue.** Currency format.

## Accessibility

- Counter reads the final value; change has text, not only colour.

## Motion

- Count-up and a path draw on arrival.
- Reduced motion: final state.
