---
title: "Statistic"
description: "Statistic component - display numbers with labels, trends, and formatting."
slug: "statistic"
---

import { DocPage, PageHeader, SkillPanel, SourceFiles, SourceNote, StatesSection, CodeBlock, Demo, DemoCode, ChangelogEntries, ArchBody, StatsClaim, StatsCards, PageOverlay, DocText, DocLink, H2, SkillField, SkillText, SkillRow, SkillGrid, Variant, ApiPill, Dim, CodeCard, TableCard } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="statistic" title="Statistic" component="statistic">
  A numeric display for key metrics. Supports title, value, description, and trend indicators.
</PageHeader>

<SkillPanel component="statistic">
  <SkillField label="Native basis">
<SkillText><code>&lt;div&gt;</code> containers displaying a numeric value with a label and optional trend indicator.</SkillText>
  </SkillField>

  <SkillField label="Web Platform APIs">
<SkillRow>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div" title="generic container"><code>&lt;div&gt;</code></ApiPill>
  </SkillRow>
  </SkillField>

  <SkillField label="Classes">
<SkillRow>
    <code>.statistic</code>
    <code>.statistic-title</code>
    <code>.statistic-value</code>
    <code>.statistic-description</code>
    <code>.statistic-trend</code>
  </SkillRow>
  </SkillField>

  <SkillField label="Data attributes">
<SkillText>• <code>data-trend</code> - values: <code>up</code>, <code>down</code></SkillText>
  </SkillField>

  <SkillField label="Accessibility">
<SkillText dense>• Use semantic text content - values are read inline</SkillText>
  <p class="text-muted-foreground m-0">• Trends are conveyed by text, not color alone ("+12.5%")</p>
  </SkillField>
</SkillPanel>

```html example label="Basic" hint="Simple statistic with title, value, and description."
<div class="statistic">
  <p class="statistic-title">Total Revenue</p>
  <p class="statistic-value">$45,231.89</p>
  <p class="statistic-description">+20.1% from last month</p>
</div>
```

```html example label="With Trend Indicator" hint="Colored trend arrows showing positive/negative movement."
<div class="statistic">
  <p class="statistic-title">Revenue</p>
  <p class="statistic-value">$45,231.89</p>
  <p class="statistic-description">
    <span class="statistic-trend" data-trend="up">
      <svg
        aria-hidden="true"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
      >
        <path d="M7 7h10v10"></path>
        <path d="M7 17 17 7"></path>
      </svg>
      +20.1%
    </span>
    from last month
  </p>
</div>
```

```html example label="In Cards" hint="Statistics composed inside card components for dashboard layouts - a card sized to its figure (width: fit-content, a min-width so a short value keeps its shape), not stretched across the page."
<article class="card" style="width: fit-content; min-width: 14rem">
  <div class="card-content" style="padding: 1.5rem">
    <div class="statistic">
      <p class="statistic-title">Total Users</p>
      <p class="statistic-value">12,489</p>
      <p class="statistic-description">
        <span class="statistic-trend" data-trend="up">+8.2%</span>
      </p>
    </div>
  </div>
</article>
```

<SourceFiles component="statistic" section="css">
  <SourceNote for="css">Styles for the statistic component. Uses design tokens for colors, spacing, and radius.</SourceNote>
</SourceFiles>

</DocPage>
