DesignOverviewDesign SystemMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingAgentsCortexMemoryActiveProvenanceActiveContextActiveServicesInsightsGet in touchSource on GitHub
Loading the reference
StatView sourceEdit in SandboxView MarkdownCopy MarkdownOpen in ClaudeOpen in CursorOne measurement, with a label that names what it measures.Also called Metric and KPI.StableSince 0.1.0DataImportimport'@fusion.dev/helix/stat'import'@fusion.dev/helix-headless/stat'Preview
GuidelinesWhen to use
One measurement with a label, such as active users on a dashboard.StatThis page
Put a Trend in the trend slot.It is read inside the stat's group, after the figure it qualifies.<helix-stat-groupdivided><helix-stat>
1,284
<spanslot="label">Active users</span><helix-trendgood="up"movement="up"slot="trend">
12%
<spanslot="label">this month</span></helix-trend></helix-stat><helix-stat>
212
<spanslot="label">Response time</span><spanslot="unit">ms</span><helix-trendgood="down"movement="up"slot="trend">
18ms
<spanslot="label">this week</span></helix-trend></helix-stat></helix-stat-group>
Set value for a figure a dashboard refreshes.A new value counts from the one before, so the figure reads as having moved, and a slotted figure changes at once.<helix-stat-groupdivided><helix-statid="readers"value="12480"><spanslot="label">Monthly readers</span></helix-stat><helix-statformat-options='{"maximumFractionDigits":1}'id="uptime"value="98.2"><spanslot="label">Uptime</span><spanslot="unit">%</span></helix-stat></helix-stat-group><helix-buttonid="refresh">Refresh</helix-button><scripttype="module">constreaders=document.getElementById('readers')constuptime=document.getElementById('uptime')// Set a new value and the figure counts to it from the one before.document.getElementById('refresh').addEventListener('click',()=>{readers.value=Math.round(readers.value*(0.85+Math.random()*0.3))uptime.value=Math.round((95+Math.random()*5)*10)/10})</script>
Anatomy
1slot="label"What the value measures, which also names the stat for a screen reader.
2::part(value)The slot the value is written in, or the figure the stat writes from value or from slotted text. A slot draws no box, so it takes the inherited properties, such as color and font, and passes them to the value.
3<helix-stat-group>OptionalA row of related measurements.
API referenceRoothelix-statOne measurement, with a label that names what it measures.
PropTypeDescriptiondirection"column-reverse"|"row"|"row-reverse"Which way the label and the value are arranged.formatOptionsIntl.NumberFormatOptionsIntl.NumberFormat options value is written with, such as
{"notation":"compact"} for 1.2M or {"style":"percent"} for 98%,
written as JSON in the attribute.localestringDefault""The locale value is written in, such as de for 1.234.567.stepNeedednumberDefault0The steps down this stat's own figure needs to fit its width, from 0 to 2,
measured at full size whatever step it shows. A group in columns reads it
to set every figure at the same step.valuenumberThe figure as a number, written with format-options in locale in
place of a slotted value.
ReadTypeDescriptionwhenSettledPromise<void>Resolves a frame after the first update, when transitions are switched on.
SlotDescription(default)The value.labelWhat the value measures, which also names the stat for a screen reader.trendHow the value moved, usually a Trend, read after the value inside the stat's group.unitThe unit, shown beside the value.
MethodTypeDescriptionshowStep(step: number) => voidSets the figure at a step, 0 for full size, without measuring it again.
PartDescriptionlabelThe slot the label arrives through, drawing no box, as value does.trendThe slot the trend arrives through, drawing no box, as value does.unitThe slot the unit arrives through, drawing no box, as value does.valueThe slot the value is written in, or the figure the stat writes from value or from slotted text. A slot draws no box, so it takes the inherited properties, such as color and font, and passes them to the value.
CSS PropertyDescription--stat-count-durationHow long a new value takes to count from the one before. Defaults to --helix-duration-slow. 0ms changes the figure at once.--stat-count-easingThe curve a new value counts along. Defaults to --helix-easing-decelerate, so the figure slows as it arrives.--stat-gapSpace between the label and the value, and between the value and the unit in a row.--stat-label-colorColor of the label.--stat-label-sizeSize of the label.--stat-unit-colorColor of the unit.--stat-unit-sizeSize of the unit.--stat-value-colorColor of the figure.--stat-value-sizeSize of the figure.
Custom stateDescriptionhas-labelSomething is slotted into label.has-trendSomething is slotted into trend.has-unitSomething is slotted into unit.numberThe slotted figure is text that reads as a number, such as 1284392118 or $8,402, so it breaks only after a group separator and never between two digits.settledSet one frame after the first render. Transitions wait for it, so an element does not animate its own arrival.steppedThe figure is set a step smaller, because at full size it does not fit the stat's width on one line.stepped-twiceThe figure is set two steps smaller, because one step smaller it still does not fit. stepped holds as well.
Grouphelix-stat-groupA row of related measurements.
PropTypeDescriptioncolumnsnumberA fixed number of equal columns, from 2 to 6. Unset, the stats wrap as they fit.dividedbooleanDefaultfalseDraws a rule between the figures, in addition to the space.labelstringDefault""Accessible name for the group, which makes it a group.
ReadTypeDescriptionwhenSettledPromise<void>Resolves a frame after the first update, when transitions are switched on.
SlotDescription(default)The stats.
MethodTypeDescriptionstepFor(stat: Element) => numberThe step a stat's figure takes: its own outside columns, and in columns the
largest any stat in the group needs, so a row of figures shares one size.
The others are set at that step as it changes.
CSS PropertyDescription--stat-group-columnsAn explicit track list while columns is set, such as one column below a width.--stat-group-gapSpace between figures.
Custom stateDescriptionsettledSet one frame after the first render. Transitions wait for it, so an element does not animate its own arrival.
Roothelix-headless-statOne measurement, with a label that names what it measures.
PropTypeDescriptiondirection"column-reverse"|"row"|"row-reverse"Which way the label and the value are arranged.formatOptionsIntl.NumberFormatOptionsIntl.NumberFormat options value is written with, such as
{"notation":"compact"} for 1.2M or {"style":"percent"} for 98%,
written as JSON in the attribute.localestringDefault""The locale value is written in, such as de for 1.234.567.stepNeedednumberDefault0The steps down this stat's own figure needs to fit its width, from 0 to 2,
measured at full size whatever step it shows. A group in columns reads it
to set every figure at the same step.valuenumberThe figure as a number, written with format-options in locale in
place of a slotted value.
ReadTypeDescriptionwhenSettledPromise<void>Resolves a frame after the first update, when transitions are switched on.
SlotDescription(default)The value.labelWhat the value measures, which also names the stat for a screen reader.trendHow the value moved, usually a Trend, read after the value inside the stat's group.unitThe unit, shown beside the value.
MethodTypeDescriptionshowStep(step: number) => voidSets the figure at a step, 0 for full size, without measuring it again.
PartDescriptionlabelThe slot the label arrives through, drawing no box, as value does.trendThe slot the trend arrives through, drawing no box, as value does.unitThe slot the unit arrives through, drawing no box, as value does.valueThe slot the value is written in, or the figure the stat writes from value or from slotted text. A slot draws no box, so it takes the inherited properties, such as color and font, and passes them to the value.
CSS PropertyDescription--stat-count-durationHow long a new value takes to count from the one before. Unset, the figure changes at once.--stat-count-easingThe curve a new value counts along.
Custom stateDescriptionhas-labelSomething is slotted into label.has-trendSomething is slotted into trend.has-unitSomething is slotted into unit.numberThe slotted figure is text that reads as a number, such as 1284392118 or $8,402, so it breaks only after a group separator and never between two digits.settledSet one frame after the first render. Transitions wait for it, so an element does not animate its own arrival.steppedThe figure is set a step smaller, because at full size it does not fit the stat's width on one line.stepped-twiceThe figure is set two steps smaller, because one step smaller it still does not fit. stepped holds as well.
Grouphelix-headless-stat-groupA row of related measurements.
PropTypeDescriptionlabelstringDefault""Accessible name for the group, which makes it a group.
ReadTypeDescriptionwhenSettledPromise<void>Resolves a frame after the first update, when transitions are switched on.
SlotDescription(default)The stats.
MethodTypeDescriptionstepFor(stat: Element) => numberThe step a stat's figure takes: its own outside columns, and in columns the
largest any stat in the group needs, so a row of figures shares one size.
The others are set at that step as it changes.
Custom stateDescriptionsettledSet one frame after the first render. Transitions wait for it, so an element does not animate its own arrival.
Examples
NameDescriptionCountingFigures that count to their new values when the page refreshes them.DirectionsA figure laid out three ways: the number above its label, in a row, and in a reversed row.PreviewFigures in a row with rules between them.PreviewFigures in a row with rules between them.TrendA figure with the trend that qualifies it, read as one group named by the label.