0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Metric cards and stat displays with numbers, labels, and change indicators. Perfect for dashboards and data summaries.
Overview
Stats patterns display key metrics at a glance. They combine large numbers with supporting context like labels, change indicators, and icons to help users quickly understand important data.
This page is the no-JS recipe. For the enhanced form with consistent layout, theme-driven trend coloring, drill-down anchors, and skeleton loading, use <score-card>. Adopting it is a small markup change: shadow-DOM slots only accept direct children, so the title, value, and change move out of the <figure> and sit directly under <score-card> with slot attributes (see score-card's static fallback).
Key features:
Semantic HTML using <figure>, <figcaption>, and <data>
Machine-readable values via the valueattribute on <data>
Trend indicators using data-trend attributes
Scoped CSS for minimal class usage
Responsive grid layout
Simple Number Grid
A clean grid of stat figures with labels and large numbers. Each stat uses a <figure> element with a <figcaption> for the label and <data> for the machine-readable value. data-layout="grid" lays them out; the scoped CSS keys on the figure's own structure, so no class is needed.
/* A stat: a figure whose caption is followed by a <data> value */@scope (figure:has(> figcaption + data)) {:scope {display: flex;flex-direction: column;gap: var(--size-2xs);margin: 0; }figcaption {font-size: var(--font-size-s);color: var(--color-text-muted); }:scope > data {font-size: var(--font-size-3xl);font-weight: var(--font-weight-bold);line-height: var(--line-height-tight); }}
With Change Indicators
Stats with trend indicators showing change from a previous period. Uses <small> with a data-trendattribute for semantic color styling. The percentage change is wrapped in a nested <data> element for machine-readability.
Stats with change indicators
<sectiondata-layout="grid"data-layout-min="s"data-layout-gap="l"aria-label="Key metrics"><figure><figcaption>Total Users</figcaption><datavalue="24521">24,521</data><smalldata-trend="up"><icon-wcname="trending-up"size="sm"></icon-wc><datavalue="0.125">+12.5%</data> vs last month</small></figure><figure><figcaption>Bounce Rate</figcaption><datavalue="0.423">42.3%</data><smalldata-trend="down"><icon-wcname="trending-down"size="sm"></icon-wc><datavalue="-0.031">-3.1%</data> vs last month</small></figure></section>
Each stat in its own card with an icon for visual distinction. At this point the recipe is exactly what <score-card> packages: title, value, change and icon slots, with trend="up|down" colouring the change.
Card-based stats
<sectiondata-layout="grid"data-layout-min="m"data-layout-gap="l"aria-label="Key metrics"><score-cardtrend="up"><spanslot="title">Total Users</span><dataslot="value"value="24521">24,521</data><smallslot="change"><datavalue="0.125">+12.5%</data> from last month</small><icon-wcslot="icon"name="users"size="md"></icon-wc></score-card><score-cardtrend="up"><spanslot="title">Revenue</span><dataslot="value"value="48352">$48,352</data><smallslot="change"><datavalue="0.082">+8.2%</data> from last month</small><icon-wcslot="icon"name="dollar-sign"size="md"></icon-wc></score-card></section>
No custom CSS: <score-card> draws the tile, sizes the value and places the icon.
Semantic Benefits
This pattern uses semantic HTML elements that provide meaning beyond visual presentation:
<figure>: Groups the stat as a self-contained unit of content
<figcaption>: Provides the label/caption for the figure
<data value="">: Contains machine-readable values for parsing by scripts or assistive technologies. The valueattribute holds the raw number while the text content shows the formatted display. Can be nested inside <small> to make change percentages machine-readable too
<small>: Indicates secondary information (the trend/change indicator)
Usage Notes
Machine-readable values: Always include the raw number in the valueattribute (e.g., value="24521" for "24,521" or value="0.032" for "3.2%"). Use nested <data> inside trend indicators for machine-readable change values (e.g., <data value="0.125">+12.5%</data>)
Color semantics: Use data-trend="up" for positive trends and data-trend="down" for negative trends
Accessibility: The semantic structure helps screen readers understand the relationship between labels and values
Responsive: The grid automatically adjusts column count based on container width
Context: Include context in trend indicators (e.g., "vs last month") so users understand what the change refers to