Sparkline
Overview
RevenueDay 24
4.6K↑ 1.5%
VisitorsDay 24
1.3K↓ 33.2%
OrdersDay 18
170↑ 31.8%
Hovered values
Revenue4.6K
Visitors1.3K
Orders176
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| Prop | Type | Default | Description |
|---|---|---|---|
key | KeepAliveKey<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.data | readonly { readonly value: number | null; readonly label?: string; }[] | Required | |
props.id | string | Required | |
props.kind | "line" | "area" | "bar" | Required | |
props.animate | boolean | — | |
props.fill | "solid" | "gradient" | — | |
props.color | string | 'var(--chart-line-primary)' | |
props.animationDuration | number | 900 | |
props.fillOpacity | number | 0.3 | |
props.height | number | 32 | |
props.padding | Show typenumber | { readonly bottom?: number; readonly left?: number; readonly right?: number; readonly top?: number; } | — | |
props.strokeWidth | number | 1.5 | |
props.width | number | model.width | |
props.className | string | — | |
props.ariaLabel | string | describeSparkline(sparklineValues(props)) | |
props.dot | boolean | — | |
props.showHighlight | boolean | — | |
props.curve | "step" | "natural" | "linear" | "monotone" | 'monotone' | |
props.yDomain | readonly [number | null, number | null] | — | |
props.springConfig | { readonly stiffness?: number; readonly damping?: number; } | — | |
props.inactiveOpacity | number | (props.kind === 'bar' ? 0.4 : 0.5) | |
props.crosshair | false | "solid" | "gradient" | "dashed" | 'dashed' | |
props.barGap | number | 2 | |
props.animationEasing | string | 'cubic-bezier(0.85, 0, 0.15, 1)' | |
props.interactive | boolean | — | |
props.hoverIndex | number | null | — | |
props.endDot | boolean | — | |
props.hoverTransition | boolean | — | |
props.barRadius | number | 1 | |
props.dataTransitionDuration | number | 500 |