Menu


Stat


One figure with its name and a line of what it means, plain or as a link to where the figure comes from.

Customize the preview


Choices
Show
View
Waiting on you
4
Pull requests to approve

Options


Stat options
ChoiceValuesDefaultWhat it does
sizesmbk-stat--size-<value>lgsmlg
Small sits closer to its edges and sets the figure a heading step smaller, for a row of many stats.
typesmbk-stat--type-<value>staticlinkstatic
A link takes the link colors and underline on its figure, and the whole tile follows it. The wrapper sets it when it is given an address.

Partssmbk-stat__namesmbk-stat__dotsmbk-stat__figuresmbk-stat__linksmbk-stat__trendsmbk-stat__descriptionsmbk-stat__chart

Examples


Usage

Three figures in a framed row: two link to where they come from, one needs attention.

Uptime
99.98%
Last 30 days

Sizes

Large and small: the small one sits closer to its edges with a smaller figure.

Deploys
128
This month
Deploys
128
This month

With a dot

A status dot before the name for a figure that needs attention, its meaning in words for screen readers.

Incidents
1
Open now

With a change and a chart

A small badge of the change after the figure, and a sparkline under the line.

Deploys
128+12%
This month
Failed builds
2+1
Since yesterday

Without a description

The line under the figure is optional.

Members
42
Seats left
8

Guidelines


Purpose

Shows one figure that matters, with its name above it and a line under it that says what the figure means: the open pull requests waiting for a review, the uptime of the last thirty days. A stat can link to where its figure comes from.

When to use

  • At the top of a dashboard or an overview, for the few figures a reader comes to check.
  • For a figure that leads somewhere: the list of what it counts, the report behind it.

When not to use

  • For a value over time. Use a chart or a sparkline.
  • For a long row of equally weighted figures with no question or action behind them. Pick the few that matter.
  • For a pair of a term and its value inside a page of details. Use a description list.

Usage rules

Do

  • Say what the figure means, and whether it is good or bad, in the description.
  • Link the figure to the list or report it comes from, when there is one.
  • Keep the name short: two or three words.

Don't

  • Put a chart with axes, or a long sentence, in a stat. The chart part is for a small line or bar.
  • Use the dot without its words.
  • Line up more figures than a reader can take in at a glance.
Open issues
27
3 more than last week
Do

Say what the figure means in the line under it.

Open issues
27
Don't

A figure with no line leaves the reader to guess whether it is good or bad.

Anatomy

  • The block, a description list of its own, on the default surface with square corners.
  • The name part, the term: what the figure counts, in a small label style and the subtle text color.
  • The dot part, an optional status dot before the name, for a figure that needs attention.
  • The figure part, the value in a heading style with digits of equal width, so figures line up and do not jump as they change.
  • The link part, the figure as a link, in the link colors and underlined, when the stat has an address.
  • The trend part, an optional mark of the change after the figure, such as a small badge.
  • The description part, an optional line under the figure in a small body style and the subtle text color.
  • The chart part, an optional small chart under the line, such as a sparkline or a meter, as wide as the stat.

Behavior

A stat is as wide as its content in running text; a grid or a row it sits in stretches it, so a row of stats can share its width equally. The description wraps, and the trend moves under the figure when there is no room beside it.

In a card's slot the stat is one of the card's parts: it drops its own padding and surface, so its name starts on the card's inset and lines up with the card's header.

A linked stat is one link. Its figure shows the link, and the whole tile follows it: pressing anywhere on the tile goes to the address. On hover and press the figure takes the link's hover and pressed colors; with the keyboard, the focus ring goes round the whole tile. The trend and the chart sit under the link's target, so a chart in a linked stat takes no pointer of its own.

Accessibility


What it does for you

  • Each stat is a description list: the name is the term, the figure and the description are its details. A screen reader says the name with the figure.
  • A linked stat is one Tab stop, named by the name and the figure together, such as "Waiting on you 4".
  • The dot's label is read as part of the name.
  • The tile is the link's target, so it is far larger than the smallest size a finger can press.

What you must do

  • Say the dot's meaning in words: give it a label such as "Needs you". Never let the dot's color be the only sign.
  • Write the trend in words and signs, such as "+12%" or "3 fewer", not as a color or an arrow alone.
  • Give a chart its summary in words, as the sparkline asks.

How to test

  • Tab through a linked stat: it is one stop, with the focus ring round the whole tile, and Enter follows its address.
  • With a screen reader, a stat is read as the name with the figure and its trend, then the description and the chart's summary; a linked one as a link by the name and the figure together; a dot's label is read as part of the name.
  • On a touch screen, a press anywhere on the tile goes to the address.
  • With text at 200% and the page 320 pixels wide, the description wraps and the figure stays whole.

Keyboard

Stat keys
KeyWhat it does
Tab
Moves focus to a linked stat, which is one stop. A stat with no address takes no keys.
Enter
Follows the linked stat's address.

Source


The files the stat is made of. Its folder on GitHub (opens in a new tab) holds them with its wrapper and its document.

Stylesheet
stat.css
/* smbk-stat — Stat. Figma "Stat" 7118:401 (Size × Type × State; Dot and Description booleans).
 * One figure with its name above it and a line under it, on the default surface with square corners:
 * the name in Label SM, the figure in a heading style with tabular digits, the line in Body SM, the
 * extra small stack step apart; an optional change badge after the figure and a small chart under the line.
 * As wide as its content in running text; a grid or a row it sits in stretches it. In a card's slot the
 * card drops its padding and fill (card.css), so it lines up with the card's other parts. A linked figure takes the link colors and underline, and its link covers the whole
 * tile, so the tile is the one place to press and the focus ring goes round it. */

.smbk-stat {
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: var(--smbk-space-stack-xs);
  margin: 0;
  padding: var(--smbk-space-inset-xl);
  vertical-align: top;
  background: var(--smbk-color-surface-default);
}

.smbk-stat__name {
  display: flex;
  align-items: center;
  gap: var(--smbk-space-inline-xs);
  margin: 0;
  color: var(--smbk-color-text-subtle);
  font-family: var(--smbk-typography-label-sm-font-family);
  font-size: var(--smbk-typography-label-sm-font-size);
  font-weight: var(--smbk-typography-label-sm-font-weight);
  line-height: var(--smbk-typography-label-sm-line-height);
  letter-spacing: var(--smbk-typography-label-sm-letter-spacing);
  text-transform: var(--smbk-typography-label-sm-text-transform);
}

.smbk-stat__figure {
  margin: 0;
  color: var(--smbk-color-text-default);
  font-family: var(--smbk-typography-heading-md-font-family);
  font-size: var(--smbk-typography-heading-md-font-size);
  font-weight: var(--smbk-typography-heading-md-font-weight);
  line-height: var(--smbk-typography-heading-md-line-height);
  letter-spacing: var(--smbk-typography-heading-md-letter-spacing);
  text-transform: var(--smbk-typography-heading-md-text-transform);
  font-variant-numeric: tabular-nums;
}

.smbk-stat__description {
  margin: 0;
  color: var(--smbk-color-text-subtle);
  font-family: var(--smbk-typography-body-sm-font-family);
  font-size: var(--smbk-typography-body-sm-font-size);
  font-weight: var(--smbk-typography-body-sm-font-weight);
  line-height: var(--smbk-typography-body-sm-line-height);
  letter-spacing: var(--smbk-typography-body-sm-letter-spacing);
}

.smbk-stat__figure:has(> .smbk-stat__trend) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--smbk-space-inline-sm);
}

/* The change after the figure, such as a small badge. A flex box, so the figure's line height leaves no
   room around it. */
.smbk-stat__trend {
  display: flex;
  align-items: center;
}

/* A small chart under the line, such as a sparkline or a meter, as wide as the stat. */
.smbk-stat__chart {
  min-width: 0;
  margin: 0;
}

/* ---- link: the figure is the link, in the link colors and underlined; its box is stretched over the
   whole tile, so pressing anywhere on the tile follows it and the ring is drawn round the tile. ---- */

.smbk-stat__link {
  color: var(--smbk-color-text-link);
  text-decoration: underline;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.smbk-stat__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

@media (hover: hover) {
  .smbk-stat__link:hover {
    color: var(--smbk-color-text-link-hover);
  }
}

.smbk-stat__link:active {
  color: var(--smbk-color-text-link-pressed);
}

.smbk-stat__link:focus-visible::after {
  outline: var(--smbk-focus-ring-width) solid var(--smbk-color-border-focus);
  outline-offset: var(--smbk-focus-ring-offset);
}

/* ---- small: closer to its edges, the figure a step smaller ---- */

.smbk-stat--size-sm {
  padding: var(--smbk-space-inset-lg);
}

.smbk-stat--size-sm .smbk-stat__figure {
  font-family: var(--smbk-typography-heading-sm-font-family);
  font-size: var(--smbk-typography-heading-sm-font-size);
  font-weight: var(--smbk-typography-heading-sm-font-weight);
  line-height: var(--smbk-typography-heading-sm-line-height);
  letter-spacing: var(--smbk-typography-heading-sm-letter-spacing);
  text-transform: var(--smbk-typography-heading-sm-text-transform);
}

/* ---- high contrast (forced colors) ---- */
/* In Windows high-contrast mode the browser drops fills and shadows; this puts the meaning back with the
   user's own colors. Nothing here applies outside that mode. */

@media (forced-colors: active) {
  /* The ring round the tile is drawn in the palette's highlight. */
  .smbk-stat__link:focus-visible::after {
    outline-color: Highlight;
  }
}
Tokens it reads
Stat tokens
Token and CSSValuePreviewFoundation
space.stack.xs--smbk-space-stack-xs4pxSpacing
space.inset.xl--smbk-space-inset-xlcomfortable: 16pxcompact: 12pxchanges with densitySpacing
color.surface.default--smbk-color-surface-defaultlight: #f3f5f8dark: #181a1cchanges with themeColor
space.inline.xs--smbk-space-inline-xs4pxSpacing
color.text.subtle--smbk-color-text-subtlelight: #4e555edark: #9ba5b1changes with themeColor
typography.label-sm--smbk-typography-label-sm-font-family--smbk-typography-label-sm-font-size--smbk-typography-label-sm-font-weight--smbk-typography-label-sm-line-height--smbk-typography-label-sm-letter-spacing--smbk-typography-label-sm-text-transformfontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 12pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px

The quick brown fox

Typography
color.text.default--smbk-color-text-defaultlight: #232527dark: #e7ebf0changes with themeColor
typography.heading-md--smbk-typography-heading-md-font-family--smbk-typography-heading-md-font-size--smbk-typography-heading-md-font-weight--smbk-typography-heading-md-line-height--smbk-typography-heading-md-letter-spacing--smbk-typography-heading-md-text-transformfontFamily: Funnel Display, Funnel Display Fallback, system-ui, sans-seriffontSize: min: 28px · max: 40pxfontWeight: 400lineHeight: 1.2letterSpacing: 0px

The quick brown fox

Typography
typography.body-sm--smbk-typography-body-sm-font-family--smbk-typography-body-sm-font-size--smbk-typography-body-sm-font-weight--smbk-typography-body-sm-line-height--smbk-typography-body-sm-letter-spacing--smbk-typography-body-sm-text-transformfontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 14pxfontWeight: 400lineHeight: 1.5letterSpacing: 0px

The quick brown fox

Typography
space.inline.sm--smbk-space-inline-smcomfortable: 6pxcompact: 4pxchanges with densitySpacing
color.text.link--smbk-color-text-linklight: #232527dark: #e7ebf0changes with themeColor
color.text.link-hover--smbk-color-text-link-hoverlight: #111213dark: #f3f5f8changes with themeColor
color.text.link-pressed--smbk-color-text-link-pressedlight: #373d43dark: #c4cdd8changes with themeColor
focus.ring.width--smbk-focus-ring-width2pxFocus
color.border.focus--smbk-color-border-focuslight: #cc0d0ddark: #f34336changes with themeColor
focus.ring.offset--smbk-focus-ring-offset2pxFocus
space.inset.lg--smbk-space-inset-lgcomfortable: 12pxcompact: 8pxchanges with densitySpacing
typography.heading-sm--smbk-typography-heading-sm-font-family--smbk-typography-heading-sm-font-size--smbk-typography-heading-sm-font-weight--smbk-typography-heading-sm-line-height--smbk-typography-heading-sm-letter-spacing--smbk-typography-heading-sm-text-transformfontFamily: Funnel Display, Funnel Display Fallback, system-ui, sans-seriffontSize: min: 24px · max: 32pxfontWeight: 400lineHeight: 1.2letterSpacing: 0px

The quick brown fox

Typography
Manifest
stat.manifest.json
{
  "name": "stat",
  "block": "smbk-stat",
  "summary": "One figure with its name and a line of what it means, plain or as a link to where the figure comes from.",
  "adapt": "css",
  "axes": {
    "size": {
      "values": [
        "lg",
        "sm"
      ],
      "default": "lg",
      "description": "Small sits closer to its edges and sets the figure a heading step smaller, for a row of many stats."
    },
    "type": {
      "values": [
        "static",
        "link"
      ],
      "default": "static",
      "description": "A link takes the link colors and underline on its figure, and the whole tile follows it. The wrapper sets it when it is given an address."
    }
  },
  "flags": {},
  "parts": [
    "name",
    "dot",
    "figure",
    "link",
    "trend",
    "description",
    "chart"
  ],
  "figmaNodeId": "7118:401"
}