Stat

Stat tile web component: a label, a large tabular value, and an optional caption or trend.

  • 1.4 KB gzipped
  • @lit-material/stat 0.0.4
  • Renders on the server

Example

Install

npm install @lit-material/stat @lit-material/tokens
import "@lit-material/stat";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-stat>

A stat tile: what is measured, its value large, and an optional caption or trend underneath — the building block of a dashboard's summary row.

Properties

PropertyAttributeTypeDefaultDescription
labellabelstring""What is measured.
valuevaluestring""The value, already formatted.
captioncaptionstring""A line under the value, e.g. "of 2,000 requests".
trendtrendStatTrend | undefinednoneDirection of change: up, down or flat.
trendLabeltrend-labelstring""The change in words, e.g. "+4.1% since yesterday" (required with trend, read aloud).
trendSentimenttrend-sentiment"positive" | "negative" | "neutral""neutral"Whether the trend is positive, negative or neutral (default) — colours it.
variantvariantStatVariant"outlined"

Slots

SlotDescription
iconAn optional icon beside the label.
captionRich caption content (replaces the caption text).

CSS parts

PartDescription
statThe tile.
labelThe label.
valueThe value.
captionThe caption row.

CSS custom properties

PropertyDescription
--lit-material-stat-value-fontThe value's font family, e.g. monospace (default: inherited).
--lit-material-stat-value-sizeThe value's font size (default 1.5rem).
--lit-material-stat-value-line-heightThe value's line height (default 2rem).
--lit-material-stat-value-weightThe value's font weight (default 600).

Source on GitHub npm