Skip to content

Sparkline

Overview

RevenueDay 24
4.6K↑ 1.5%
VisitorsDay 24
1.3K↓ 33.2%
OrdersDay 18
170↑ 31.8%

Hovered values

Revenue
4.6K
Visitors
1.3K
Orders
176

Crosshair styles

dashed
solid
gradient

Hover feel

Spring (default)
Snappy
No spring

Many on one page

API Reference

Types come from the public API. A dash indicates no default is documented here.

Sparkline props

Public source
PropTypeDefaultDescription
keyKeepAliveKey<K, Ends> | undefined''The child's identity among its parent's children of one component, or a kept child's among its author's. The empty string by default.
onEmit
Show type
((events: { readonly _tag: "HoverChanged"; readonly index: number | null; }) => NoInfer<Msg> | undefined) | { readonly HoverChanged: (event: { readonly _tag: "HoverChanged"; readonly index: number | null; }) => NoInfer<Msg> | undefined; } | undefined
—Handle the child's events with a callback, or supply one handler per tag for tagged events. Return a parent message to dispatch it, or `undefined` to ignore the event.
props.datareadonly { readonly value: number | null; readonly label?: string; }[]Required
props.idstringRequired
props.kind"line" | "area" | "bar"Required
props.animateboolean—
props.fill"solid" | "gradient"—
props.colorstring'var(--chart-line-primary)'
props.animationDurationnumber900
props.fillOpacitynumber0.3
props.heightnumber32
props.padding
Show type
number | { readonly bottom?: number; readonly left?: number; readonly right?: number; readonly top?: number; }
—
props.strokeWidthnumber1.5
props.widthnumbermodel.width
props.classNamestring—
props.ariaLabelstringdescribeSparkline(sparklineValues(props))
props.dotboolean—
props.showHighlightboolean—
props.curve"step" | "natural" | "linear" | "monotone"'monotone'
props.yDomainreadonly [number | null, number | null]—
props.springConfig{ readonly stiffness?: number; readonly damping?: number; }—
props.inactiveOpacitynumber(props.kind === 'bar' ? 0.4 : 0.5)
props.crosshairfalse | "solid" | "gradient" | "dashed"'dashed'
props.barGapnumber2
props.animationEasingstring'cubic-bezier(0.85, 0, 0.15, 1)'
props.interactiveboolean—
props.hoverIndexnumber | null—
props.endDotboolean—
props.hoverTransitionboolean—
props.barRadiusnumber1
props.dataTransitionDurationnumber500