Skip to content
Klarhimmel UI

App, stat panel row

App, stat panel row previewApp, stat panel row preview

Install

npx shadcn add @klarhimmel/app-dashboard-stats
DetailsAbout, usage, props and more

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.

Import

Import

import Block from '@/components/klarhimmel/blocks/app-dashboard-stats';
Also called
  • app/dashboard-stats
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.
Category
Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

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.

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.

PropTypeDefaultDescription
eyebrowstring'Overview'Text, up to 60 characters. Optional; empty is not rendered.
titlestring'Name the period or scope'Text, up to 120 characters.
descriptionstring'Say how it is going and what it is …'Text, up to 300 characters. Optional; empty is not rendered.
items{ label, value, change, trend, against }[]4 itemsList of 2 to 4. Each item: label, value, change, trend ('up' | 'down' | 'flat'), against.
state'filled' | 'loading' | 'error''filled'One of 'filled', 'loading', 'error'.
messages{ loading, error, retry }{…}Fields: loading, error, retry.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.