DesignOverviewDesign SystemMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingAgentsCortexMemoryActiveProvenanceActiveContextActiveServicesInsightsGet in touchSource on GitHub
Loading the reference
SparklineView sourceEdit in SandboxView MarkdownCopy MarkdownOpen in ClaudeOpen in CursorA small chart with no axes that shows the shape of a series beside its number.Also called Micro Chart, Trend Line, and Inline Chart.StableSince 0.1.0ChartsImportimport'@fusion.dev/helix/sparkline'import'@fusion.dev/helix-headless/sparkline'Preview
GuidelinesWhen to use
The shape of a series beside its number, such as in a stat or a table row.SparklineThis page
Set values to the numbers, and use for only where a real table stands behind the sparkline.A table behind a small trend line would be read aloud row by row.
Place the sparkline beside a Stat.A change beside a figure is a second fact, and Trend is placed the same way.
API referenceRoothelix-sparklineA small chart with no axes that shows the shape of a series beside its number.
PropTypeDescriptioncurve"smooth"|"step"|"straight"How the line is drawn from one reading to the next.emphasis"outlined"|"solid"|"subtle"How strongly the line, area, or columns are drawn.emptyTextstringDefault"No readings"The words shown in place of the line when there are no readings, and the
fallback of the empty slot.errorTextstringDefault""The words shown in place of the line when the readings did not load, such
as "The visits did not load". Empty, the default, shows nothing.forstringDefault""The id of a table to read the readings from, when a table holds the data.labelstringDefault""A sentence that describes what the line shows.loadingbooleanDefaultfalseWhether the readings are still on their way. The sparkline shows
loading-text in place of an empty drawing until it has readings.loadingTextstringDefault"Loading readings"The words shown in place of the line while loading is set and there are
no readings yet, and the fallback of the loading slot.localestringDefault""The locale the words, the readout's numbers and positions are in, such
as de for 1.240.marksstringDefault""Which readings take a mark of their own: high, low, or both,
separated by spaces.overviewLabelstringDefault"From {first} to {last}, highest {high}, lowest {low}"What the readings come to, said after the name: {first} and {last}
for the first and the last reading, {high} and {low} for the highest
and the lowest, each written as the readout writes it.plot"area"|"bar"|"line"What the readings are drawn as.positionLabelstringDefault"{position} of {count}"Where a reading the keys moved to stands among the readings, said after
it. {position} and {count} are replaced with the numbers, written in
locale.rangestringDefault""Two values a band is drawn between, behind the line, separated by a
space: range="60 100" marks a normal range.terminus"none"|"ring"|"square"|"triangle"The shape of the mark on the last reading.valuesstring|readonlynumber[]Default""The numbers, separated by whitespace or by commas.weight"thick"|"thin"How thick the line is drawn.
ReadTypeDescriptionnamedstringThe drawing's name: an aria-label written on the sparkline, then label.readingsnumberHow many readings there are, which the pointer and the keys walk.whenSettledPromise<void>Resolves a frame after the first update, when transitions are switched on.
SlotDescriptionemptyContent shown in place of the line when there are no readings. Falls back to empty-text.errorContent shown after error-text while it is set and there are no readings, such as a button that tries again.loadingContent shown in place of the line while loading is set and there are no readings yet. Falls back to loading-text.
EventTypeDescriptionhelix-reading-changeHelixReadingChangeEventThe reading shown moved, or was put away: index is the reading, or -1 for none, with its row's label from a table and the pointerType that moved it.helix-reading-pressHelixReadingPressEventA reading was clicked, tapped, or pressed with Enter or Space, with the same detail as helix-reading-change.
PartDescriptionareaThe region between the line and the bottom of its range.barOne column, drawn when plot="bar".cursorThe mark on the reading a pointer or a key rests on, rendered only while there is one. Placed with inset-inline-start and inset-block-start.emptyThe words in place of the line when there are no readings: the empty slot, falling back to empty-text. Not drawn while a table named by for cannot be read yet, on the server and during hydration.errorThe words in place of the line while error-text is set and there are no readings, followed by the error slot. Announced as it appears.highThe mark on the highest reading, under marks="high". Placed as cursor is.lineThe line's path.liveA polite region that says the reading a key moved to, rendered only with a label. Hide it visually.loadingThe words in place of the line while loading is set and there are no readings: the loading slot, falling back to loading-text.loneThe mark on a reading no line reaches, with a blank or an end on each side. Placed as cursor is.lowThe mark on the lowest reading, under marks="low". Placed as cursor is.overviewWhat the readings come to, in overview-label, which describes the drawing. Rendered hidden with a name, since it is read through the description and not shown.rangeThe band between the two values of range, drawn behind the line.readoutThe reading a pointer or a key rests on, as the table or values writes it, rendered only while there is one. Placed as cursor is.svgThe drawing, which takes focus to be read by key where there is a label.terminusThe mark on the last value. It carries data-jumped for the drawing where the line took a new shape at once, with a value more or fewer, so a stylesheet moving the mark can move it at once too.wash-endThe far stop of the area's gradient.wash-startThe stop of the area's gradient that meets the line.
CSS PropertyDescription--chart-glide-durationHow long the dot on a reading and its words take to glide from one reading to the next, along --helix-easing-decelerate, as the pointer or the keys move. Defaults to --helix-duration-fast. 0s places them at once, and under reduced motion they move at once, whatever it says. They are placed where their reading is when a reading is shown from none. Bar Chart, Line Chart, Area Chart, Donut Chart, Scatter Chart, Sparkline, and Heatmap share this property.--chart-move-durationHow long a mark takes to move to a new reading. Defaults to --helix-duration-normal. 0s moves nothing, and under reduced motion nothing moves, whatever it says. Bar Chart, Line Chart, Area Chart, Donut Chart, Scatter Chart, Sparkline, and Heatmap share this property.--chart-move-easingThe curve a mark moves to a new reading along. Defaults to --helix-easing-decelerate. Bar Chart, Line Chart, Area Chart, Donut Chart, Scatter Chart, Sparkline, and Heatmap share this property.--chart-terminus-holeA fill for the middle of a ring terminus. Without it, the middle is open.--chart-terminus-sizeSize of the mark on the last reading.--chart-terminus-xWhere the last point sits horizontally, as a percentage.--chart-terminus-yWhere the last point sits vertically, as a percentage.--sparkline-area-opacityOpacity of the area fill where it meets the line.--sparkline-bar-radiusCorner radius of a column, when plot="bar".--sparkline-bar-strokeThickness of a column's edge when emphasis is outlined.--sparkline-block-sizeHeight of the drawing.--sparkline-colorColor of the line, the area fill, the columns, and the mark.--sparkline-inline-sizeWidth of the drawing.--sparkline-mark-colorColor of the dot on the reading a pointer or a key rests on, and of the marks dots. Without it, the line's color.--sparkline-mark-ring-colorColor of the ring round the dot on the reading a pointer or a key rests on, which matches the page. Change it when the sparkline sits on another surface.--sparkline-mark-sizeSize of the dot on the reading a pointer or a key rests on, and of the marks dots.--sparkline-range-colorFill of the band range draws. Without it, the line's color.--sparkline-range-opacityOpacity of the band range draws.--sparkline-readout-background-colorGround of the reading written above the dot.--sparkline-readout-colorColor of the reading written above the dot.--sparkline-readout-font-sizeSize of the reading written above the dot.--sparkline-widthThickness of the line, overriding weight.
Custom stateDescriptionemptyWhile the empty part stands in place of the line.errorWhile the error part stands in place of the line.loadingWhile the loading part stands in place of the line.settledSet one frame after the first render. Transitions wait for it, so an element does not animate its own arrival.
Roothelix-headless-sparklineA small chart with no axes that shows the shape of a series beside its number.
PropTypeDescriptioncurve"smooth"|"step"|"straight"How the line is drawn from one reading to the next.emptyTextstringDefault"No readings"The words shown in place of the line when there are no readings, and the
fallback of the empty slot.errorTextstringDefault""The words shown in place of the line when the readings did not load, such
as "The visits did not load". Empty, the default, shows nothing.forstringDefault""The id of a table to read the readings from, when a table holds the data.labelstringDefault""A sentence that describes what the line shows.loadingbooleanDefaultfalseWhether the readings are still on their way. The sparkline shows
loading-text in place of an empty drawing until it has readings.loadingTextstringDefault"Loading readings"The words shown in place of the line while loading is set and there are
no readings yet, and the fallback of the loading slot.localestringDefault""The locale the words, the readout's numbers and positions are in, such
as de for 1.240.marksstringDefault""Which readings take a mark of their own: high, low, or both,
separated by spaces.overviewLabelstringDefault"From {first} to {last}, highest {high}, lowest {low}"What the readings come to, said after the name: {first} and {last}
for the first and the last reading, {high} and {low} for the highest
and the lowest, each written as the readout writes it.plot"area"|"bar"|"line"What the readings are drawn as.positionLabelstringDefault"{position} of {count}"Where a reading the keys moved to stands among the readings, said after
it. {position} and {count} are replaced with the numbers, written in
locale.rangestringDefault""Two values a band is drawn between, behind the line, separated by a
space: range="60 100" marks a normal range.valuesstring|readonlynumber[]Default""The numbers, separated by whitespace or by commas.
ReadTypeDescriptionnamedstringThe drawing's name: an aria-label written on the sparkline, then label.readingsnumberHow many readings there are, which the pointer and the keys walk.whenSettledPromise<void>Resolves a frame after the first update, when transitions are switched on.
SlotDescriptionemptyContent shown in place of the line when there are no readings. Falls back to empty-text.errorContent shown after error-text while it is set and there are no readings, such as a button that tries again.loadingContent shown in place of the line while loading is set and there are no readings yet. Falls back to loading-text.
EventTypeDescriptionhelix-reading-changeHelixReadingChangeEventThe reading shown moved, or was put away: index is the reading, or -1 for none, with its row's label from a table and the pointerType that moved it.helix-reading-pressHelixReadingPressEventA reading was clicked, tapped, or pressed with Enter or Space, with the same detail as helix-reading-change.
PartDescriptionareaThe region between the line and the bottom of its range.barOne column, drawn when plot="bar".cursorThe mark on the reading a pointer or a key rests on, rendered only while there is one. Placed with inset-inline-start and inset-block-start.emptyThe words in place of the line when there are no readings: the empty slot, falling back to empty-text. Not drawn while a table named by for cannot be read yet, on the server and during hydration.errorThe words in place of the line while error-text is set and there are no readings, followed by the error slot. Announced as it appears.highThe mark on the highest reading, under marks="high". Placed as cursor is.lineThe line's path.liveA polite region that says the reading a key moved to, rendered only with a label. Hide it visually.loadingThe words in place of the line while loading is set and there are no readings: the loading slot, falling back to loading-text.loneThe mark on a reading no line reaches, with a blank or an end on each side. Placed as cursor is.lowThe mark on the lowest reading, under marks="low". Placed as cursor is.overviewWhat the readings come to, in overview-label, which describes the drawing. Rendered hidden with a name, since it is read through the description and not shown.rangeThe band between the two values of range, drawn behind the line.readoutThe reading a pointer or a key rests on, as the table or values writes it, rendered only while there is one. Placed as cursor is.svgThe drawing, which takes focus to be read by key where there is a label.terminusThe mark on the last value. It carries data-jumped for the drawing where the line took a new shape at once, with a value more or fewer, so a stylesheet moving the mark can move it at once too.wash-endThe far stop of the area's gradient.wash-startThe stop of the area's gradient that meets the line.
CSS PropertyDescription--chart-terminus-xWhere the last point sits horizontally, as a percentage.--chart-terminus-yWhere the last point sits vertically, as a percentage.
Custom stateDescriptionemptyWhile the empty part stands in place of the line.errorWhile the error part stands in place of the line.loadingWhile the loading part stands in place of the line.settledSet one frame after the first render. Transitions wait for it, so an element does not animate its own arrival.
Examples
NameDescriptionCurvesThe same seven readings drawn with three curves, each showing the values between readings differently.EmphasisEmphasis values on a line, an area, and bars, because an outline and a fill look different on each shape.From a tableThe same line read from a table, which is visually hidden and still read by screen readers.PaletteAll twenty-four series colors, eight hues in three tones, on identical readings as a line and as an area.PreviewThe same seven days as bars, as a line, and as an area.PreviewThe same seven days as bars, as a line, and as an area.StatesA sparkline while its readings load, and a sparkline with no readings, with its own empty-text.Taking new dataA line given a new day's number, moving to its new shape with its end mark.TerminiFive shapes for the end of a line, shared with every chart that draws a line.WeightThe same line drawn thin, at its resting weight, and thick.