# Stat

A formatted number with its label, optional change and note, for rows of metrics.

- **Use it for**: A key number with its label and change, in a row of metrics.
- **Not for**: Trends over time. Try [Chart](https://unseenui.com/components/chart/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { Stat } from '@stackunseen/ui';
import { StatGroup } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<Stat variant="card"Group aria-label="Usage">
  <Stat label="Active users" value="1,204" delta="+12%" trend="up" note="Last 30 days" />
</StatGroup>
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `delta` | `ReactNode` | A formatted change, for example "+12%"; the sign must be in the text, not only the colour. |
| `label` (required) | `ReactNode` |  |
| `note` | `ReactNode` |  |
| `trend` | `"up" \| "down" \| "neutral"` |  |
| `value` (required) | `ReactNode` | A formatted value from the application; the component never computes or abbreviates. |
| `variant` | `"card" \| "plain" \| "inset"` | Card gives each stat its own surface; plain is the bare figure for dense rows; inset is one surface step down for small figures inside a card, under a chart or a larger number. |

## Keyboard

Inert content; it adds no tab stop.

## Works with

[Card](https://unseenui.com/components/card/), [Table](https://unseenui.com/components/table/), [Tag](https://unseenui.com/components/tag/), [DiffStat](https://unseenui.com/components/diff-stat/), [ElapsedTime](https://unseenui.com/components/elapsed-time/), [Numeric](https://unseenui.com/components/numeric/), [Kbd](https://unseenui.com/components/kbd/), [DotRing](https://unseenui.com/components/dot-ring/), [DotBars](https://unseenui.com/components/dot-bars/), [WeekStrip](https://unseenui.com/components/week-strip/), [HeatKeys](https://unseenui.com/components/heat-keys/), [Sparkline](https://unseenui.com/components/sparkline/)

Page: https://unseenui.com/components/stat/
