docs/components/display/Sparkline

Sparkline

Mini inline chart.

import { Sparkline } from '@ybouhjira/hyperkit';

#Playground

Edit the code — the preview recompiles and re-renders as you type.

Live playground
Loading preview…

#More Examples

Empty Data

<Sparkline data={[]} />

#Props

PropTypeDefaultDescription
data *number[]Array of numeric data points to render.
widthnumber80Width of the SVG in pixels.
heightnumber24Height of the SVG in pixels.
colorstring'var(--sk-accent)'Stroke color for the line.
strokeWidthnumber1.5Stroke width for the line.
filledbooleanfalseFill area below the line with a gradient.
animatebooleanfalseAnimate the line drawing on mount.
classstringAdditional CSS classes.
styleimport('solid-js').JSX.CSSPropertiesInline styles.

* required prop.

#Design Tokens

This component reads the following CSS custom properties. Override them globally or per-instance to restyle it — see the CSS Variables guide.

  • --sk-duration-slow