# Stat panel row

- **[App UI](/app/)**
- **[Dashboard](/app/dashboard/)**
- **Stat panel row**

A row of two to four figures for a dashboard: label, large value, the change with a sign and an arrow, and what it is measured against.

## Notes

- **When to use it**: A row of two to four figures at the top of a dashboard, each with a change and a comparison. When you need a trend across time use `app-dashboard-chart`.
- **Writing for it**: - Each item has a `label` (40), a large `value` (20) and a `change` (30). Include the sign in the change text, such as +12%, because the arrow only repeats the direction.
- `against` (40) names the baseline, for instance vs last month. Without it a change figure has nothing to compare with.
- Keep `value` short enough for a large type size: 20 characters is the limit, and 6 to 8 usually fits four columns.
- **Watch out for**: There must be at least 2 items and at most 4. The `trend` value sets the arrow, not the colour meaning, so a down arrow on churn is still shown the same as a down arrow on revenue.

## Pairs well with

- **[App, chart card](/blocks/app/dashboard-chart)**
- **[App, data table](/blocks/app/data-table)**
- **[App, kanban board](/blocks/app/boards-kanban)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppDashboardStats from '@/components/klarhimmel/blocks/app-dashboard-stats';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppDashboardStats props={{
          "eyebrow": "Overview",
          "title": "Name the period or scope",
          "description": "Say how it is going and what it is compared with.",
          "items": [
            {
              "label": "Name a measure",
              "value": "00%",
              "change": "+0%",
              "trend": "up",
              "against": "vs before"
            },
            {
              "label": "Name a measure",
              "value": "000",
              "change": "+00",
              "trend": "up",
              "against": "vs before"
            },
            {
              "label": "Name a measure",
              "value": "0.0 units",
              "change": "0.0",
              "trend": "flat",
              "against": "vs before"
            },
            {
              "label": "Name a measure",
              "value": "0",
              "change": "−0",
              "trend": "down",
              "against": "vs before"
            }
          ],
          "state": "filled",
          "messages": {
            "loading": "Say they are loading",
            "error": "Say the figures did not load and to retry.",
            "retry": "Try again"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **eyebrow**: Text, up to 60 characters. Optional; empty is not rendered.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters. Optional; empty is not rendered.
- **items**: List of 2 to 4. Each item: label, value, change, trend ('up' | 'down' | 'flat'), against.
- **state**: One of 'filled', 'loading', 'error'.
- **messages**: Fields: loading, error, retry.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-dashboard-stats
  ```

Uses

- Banner
- Button
- Skeleton

- **About**: A row of two to four figures for a dashboard: label, large value, the change with a sign and an arrow, and what it is measured against. A definition list for assistive tech, with loading and error states.
- **States**: Filled, loading and error. Up, down or flat; the arrow always comes with a signed number. New project? Set it up once: /get-started/installation.
