One figure with its name and a line of what it means, plain or as a link to where the figure comes from.
- Waiting on you
- 4
- Pull requests to approve
Options
| Choice | Values | Default | What it does |
|---|---|---|---|
sizesmbk-stat--size-<value> | lgsm | lg | Small sits closer to its edges and sets the figure a heading step smaller, for a row of many stats. |
typesmbk-stat--type-<value> | staticlink | static | 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. |
Examples
Usage
Three figures in a framed row: two link to where they come from, one needs attention.
Sizes
Large and small: the small one sits closer to its edges with a smaller figure.
- Deploys
- 128
- This month
- Deploys
- 128
- This month
As a link
The figure takes the link colors and underline; the whole tile is the link.
With a dot
A status dot before the name for a figure that needs attention, its meaning in words for screen readers.
- Waiting on you
- 4
- Pull requests to approve
- 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
Say what the figure means in the line under it.
- Open issues
- 27
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
| Key | What 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
/* 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
| Token and CSS | Value | Preview | Foundation |
|---|---|---|---|
| space.stack.xs--smbk-space-stack-xs | 4px | Spacing | |
| space.inset.xl--smbk-space-inset-xl | comfortable: 16pxcompact: 12pxchanges with density | Spacing | |
| color.surface.default--smbk-color-surface-default | light: #f3f5f8dark: #181a1cchanges with theme | Color | |
| space.inline.xs--smbk-space-inline-xs | 4px | Spacing | |
| color.text.subtle--smbk-color-text-subtle | light: #4e555edark: #9ba5b1changes with theme | Color | |
| 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-transform | fontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 12pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px | The quick brown fox | Typography |
| color.text.default--smbk-color-text-default | light: #232527dark: #e7ebf0changes with theme | Color | |
| 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-transform | fontFamily: 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-transform | fontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 14pxfontWeight: 400lineHeight: 1.5letterSpacing: 0px | The quick brown fox | Typography |
| space.inline.sm--smbk-space-inline-sm | comfortable: 6pxcompact: 4pxchanges with density | Spacing | |
| color.text.link--smbk-color-text-link | light: #232527dark: #e7ebf0changes with theme | Color | |
| color.text.link-hover--smbk-color-text-link-hover | light: #111213dark: #f3f5f8changes with theme | Color | |
| color.text.link-pressed--smbk-color-text-link-pressed | light: #373d43dark: #c4cdd8changes with theme | Color | |
| focus.ring.width--smbk-focus-ring-width | 2px | Focus | |
| color.border.focus--smbk-color-border-focus | light: #cc0d0ddark: #f34336changes with theme | Color | |
| focus.ring.offset--smbk-focus-ring-offset | 2px | Focus | |
| space.inset.lg--smbk-space-inset-lg | comfortable: 12pxcompact: 8pxchanges with density | Spacing | |
| 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-transform | fontFamily: Funnel Display, Funnel Display Fallback, system-ui, sans-seriffontSize: min: 24px · max: 32pxfontWeight: 400lineHeight: 1.2letterSpacing: 0px | The quick brown fox | Typography |
Manifest
{
"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"
}