# Stat Card

> One key number with its change and a sparkline.

```tsx
import { StatCard } from '@brand-studio/ui';

export default function StatCardDemo() {
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 16, width: '100%', maxWidth: 560 }}>
      <StatCard label="Active subscribers" value="1,284" change="+6.1%" trend="up" note="74 more than last month" series={[1120, 1142, 1150, 1181, 1176, 1210, 1244, 1284]} />
      <StatCard label="Skipped deliveries" value="38" change="−12%" trend="down" note="5 fewer than last month" series={[52, 49, 47, 44, 45, 43, 40, 38]} />
    </div>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, StatCard } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { StatCard } from '@brand-studio/ui';
```

```tsx
<StatCard label="Active subscribers" value="1,284" change="+6.1%" trend="up" series={[1120, 1181, 1244, 1284]} />
```

## Accessibility

- The change is read with its direction in words, such as “Up +6.1%”, not by arrow or colour alone.
- The sparkline is decorative and hidden from screen readers. Put the numbers that matter in `value` and `note`.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `label` | `string` | – |
| `value` | `React.ReactNode` | – |
| `change?` | `string` | – |
| `trend?` | `"down" \| "flat" \| "up"` | `'flat'` |
| `note?` | `React.ReactNode` | – |
| `series?` | `number[]` | – |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/stat-card/
