0|

Sparkline Chart

Documentation Index

Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.

Compact inline sparklines for KPIs, tables, and dense dashboards

Basic Chart

Installation

pnpm dlx shadcn@latest add @beecharts/sparkline-chart

Usage

Sparklines are built for small, axis-free trend strips — not a shrunken line chart. Unlike <BeeLineChart />, which usually scales from zero and shows axes, legends, and brush, sparklines pin the Y domain to your data min/max (with a little padding) so variation fills the full height of a short container. Pass rows with a numeric valueDataKey, map series colors through chartConfig, and compose only the pieces you need — typically <Sparkline />, optionally <Fill />, <EndDot />, <ReferenceBand />, or <Tooltip />. Size the chart with className (for example h-16 w-full).

import {
  BeeSparklineChart,
  Sparkline,
  Fill,
  EndDot,
  Tooltip,
} from "@/components/beecharts/charts/sparkline-chart";
const data = [{ value: 12 }, { value: 18 }, { value: 24 }];
 
const chartConfig = {
  trend: {
    label: "Sessions",
    colors: { light: ["#047857"], dark: ["#10b981"] },
  },
} satisfies ChartConfig;
 
<BeeSparklineChart
  data={data}
  valueDataKey="value"
  config={chartConfig}
  backgroundVariant="dots"
  className="h-12 w-40"
>
  <Fill dataKey="trend" />
  <Sparkline dataKey="trend">
    <EndDot variant="colored-border" />
  </Sparkline>
  <Tooltip defaultIndex={data.length - 1} />
</BeeSparklineChart>

Loading State

isLoading='true'

Examples

Background patterns

dots + fill
bubbles

Pass backgroundVariant on the root (e.g. dots, graph-paper, cross-hatch, bubbles). Or compose <ChartBackground variant="graph-paper" /> inside BeeSparklineChart. Requires @beecharts/background when installing manually.

Area Fill

gradient fill

Glowing Stroke

glowing

End Dot + Tooltip

end dot

Reference Band

reference band

API Reference

BeeSparklineChart

Root container for compact line charts. Renders a hidden Y axis with a data-min / data-max domain (not zero-based). No visible axes — consumers control footprint via className.

PropTypeDefaultDescription
config*ChartConfig

Series labels and theme-aware gradient colors keyed by each <Sparkline dataKey />.

data*TData[]

Rows containing the numeric field referenced by valueDataKey.

valueDataKey*keyof TData & string

Numeric column plotted on the sparkline (for example "value").

children*ReactNode

Compose <Fill />, <Sparkline />, <ReferenceBand />, <Tooltip />.

classNamestring

Size and layout classes on <ChartContainer /> (height/width for inline use).

curveTypeCurveType"monotone"

Default interpolation inherited by <Sparkline /> and <Fill />.

animationTypenone|left-to-right"left-to-right"

Intro reveal mask; respects OS reduce-motion preference.

isLoadingbooleanfalse

Shows shimmer skeleton line instead of composed series.

loadingPointsnumber18

Number of placeholder points during loading.

backgroundVariantBackgroundVariant

Draws <ChartBackground /> behind the series (dots, grid, bubbles, etc.).

chartPropsComponentProps<typeof LineChart>

Escape hatch to Recharts <LineChart /> (margins, syncId, etc.).

Sparkline

Single-series stroke with optional glow, dashed stroke, and terminal <EndDot />.

PropTypeDefaultDescription
dataKey*string

Key into chartConfig for gradients and tooltip labels.

strokeVariantsolid|dashed"solid"

Stroke dash pattern.

glowingbooleanfalse

Applies soft SVG glow filter to the stroke.

childrenReactNode

Optional <EndDot variant="..." /> configuration slot.

Fill

Gradient area under the stroke (render before <Sparkline /> so the line stays on top).

PropTypeDefaultDescription
dataKey*string

Config key shared with <Sparkline />.

fillOpacitynumber1

Opacity multiplier on the fill pattern.

EndDot

Configuration slot — renders a <ChartDot /> on the last point only when composed inside <Sparkline />.

PropTypeDefaultDescription
variantDotVariant

Dot style forwarded to @beecharts/dot.

ReferenceBand

Muted horizontal band for targets, SLA ranges, or baselines.

PropTypeDefaultDescription
y1*number

Lower bound in data units.

y2*number

Upper bound in data units.

fillOpacitynumber0.12

Band fill strength.

Tooltip

Compact hover readout; cursor line disabled by default for inline charts.

PropTypeDefaultDescription
variantTooltipVariant

Tooltip surface style.

cursorbooleanfalse

Vertical crosshair while hovering.

defaultIndexnumber

Highlights a point while idle (useful with <EndDot /> on the last index).