Stat

Small block components that can be used to show metric displays with a label, value, and optional description

Examples

Basic usage

Revenue $12,450 +12.5% vs last month
<div class="stat">
            <span class="stat-label">Revenue</span>
            <span class="stat-value">$12,450</span>
            <span class="stat-description">
                <span class="trend is-up">+12.5%</span> vs last month
            </span>
        </div>

Grid of stat cards

Revenue $12,450 +12.5% vs last month
Open issues 37 -8 from last week
Uptime 99.98% 0.0% change
<div class="grid" style="--grid-min: 14rem">
            <div class="card">
                <div class="stat">
                    <span class="stat-label">Revenue</span>
                    <span class="stat-value">$12,450</span>
                    <span class="stat-description">
                        <span class="trend is-up">+12.5%</span> vs last month
                    </span>
                </div>
            </div>
            <div class="card">
                <div class="stat">
                    <span class="stat-label">Open issues</span>
                    <span class="stat-value">37</span>
                    <span class="stat-description">
                        <span class="trend is-down">-8</span> from last week
                    </span>
                </div>
            </div>
            <div class="card">
                <div class="stat">
                    <span class="stat-label">Uptime</span>
                    <span class="stat-value">99.98%</span>
                    <span class="stat-description">
                        <span class="trend is-neutral">0.0%</span> change
                    </span>
                </div>
            </div>
        </div>

Compact

Users 1,204
Sessions 3,891
Bounce rate 24.3%
<div class="grid" style="--grid-min: 10rem">
            <div class="stat is-compact">
                <span class="stat-label">Users</span>
                <span class="stat-value">1,204</span>
            </div>
            <div class="stat is-compact">
                <span class="stat-label">Sessions</span>
                <span class="stat-value">3,891</span>
            </div>
            <div class="stat is-compact">
                <span class="stat-label">Bounce rate</span>
                <span class="stat-value">24.3%</span>
            </div>
        </div>

Minimal -- without trend

Open issues 37 4 critical, 12 in review
<div class="stat">
            <span class="stat-label">Open issues</span>
            <span class="stat-value">37</span>
            <span class="stat-description">4 critical, 12 in review</span>
        </div>

Semantic markup with <dl>

Revenue
$12,450
+12.5% vs last month
<dl class="stat">
            <dt class="stat-label">Revenue</dt>
            <dd class="stat-value">$12,450</dd>
            <dd class="stat-description"><span class="trend is-up">+12.5%</span> vs last month</dd>
        </dl>

Source comments

Stat -- metric display: label, big number, optional description /
trend (extra).

Pairs with .trend (separate file in extras) for inline delta
indicators inside .stat-description.

Markup:
  <div class="stat">
      <span class="stat-label">Revenue</span>
      <span class="stat-value">$12,450</span>
      <span class="stat-description">
          <span class="trend is-up">+12.5%</span> vs last month
      </span>
  </div>

  <div class="stat is-compact">
      <span class="stat-label">Open Issues</span>
      <span class="stat-value">37</span>
  </div>

Archetype: Slotted container (P3). Pure CSS, no JS. The slot
classes carry typography that existing utilities can't cleanly
combine (--stat-value's line-height: 1 + tight letter-spacing,
--stat-description's body line-height + muted color).

Semantic markup alternative: a <dl> can replace the plain
<span>s for explicit description-list semantics:
  <dl class="stat">
      <dt class="stat-label">Revenue</dt>
      <dd class="stat-value">$12,450</dd>
      <dd class="stat-description">...</dd>
  </dl>
brio's slot classes work on either markup. <dl> announces the
label-value relationship to assistive tech; consumers in
data-heavy contexts may prefer it.

Reference

Source: src/css/extras/stat.css

Applies to

.stat

Classes

ClassKindDescription
.is-compactvariantTighter layout with smaller value for dense dashboard cards

Slots

SlotDescription
& .stat-labelLabel text identifying the metric
& .stat-valueLarge number or formatted value
& .stat-descriptionSupplementary text or trend indicator

Tokens

TokenDefaultDescription
--stat-gapvar(--ui-gutter-tight)Gap between the label, value, and description slots
--stat-label-font-sizevar(--font-size-xs)Font size for the metric label
--stat-value-font-sizevar(--font-size-xl)Font size for the big number
--stat-description-font-sizevar(--font-size-xs)Font size for the supplementary description
--stat-label-colorvar(--color-text-muted)Text color for the label
--stat-value-colorvar(--color-text)Text color for the value