shadcn.io is an independent project built on shadcn/ui
On this page20 sections
Installation
The command adds the example above to components/charts/ and, the first time, the chart kit to components/ui/charts/. Both are source files in your project from then on: read them, change them, delete what you don't use.
Usage
Rows are shaped as they are for the line chart: a Date under date (or your xDataKey) and a number for each series.
import {
Area,
AreaChart,
ChartTooltip,
Grid,
XAxis,
} from "@/components/ui/charts";
const data = [
{ date: new Date(2026, 9, 1), signups: 182 },
{ date: new Date(2026, 9, 2), signups: 214 },
{ date: new Date(2026, 9, 3), signups: 196 },
{ date: new Date(2026, 9, 4), signups: 241 },
{ date: new Date(2026, 9, 5), signups: 228 },
];
export const SignupsChart = () => (
<AreaChart ariaLabel="Daily sign-ups" data={data}>
<Grid horizontal />
<Area dataKey="signups" fill="var(--chart-1)" label="Sign-ups" />
<XAxis />
<ChartTooltip />
</AreaChart>
);Anatomy
The line chart's parts, with Area in place of Line. Children draw in the order you write them, so a fill written later covers the ones before it.
<AreaChart data={data}>
<Grid horizontal />
<Area dataKey="desktop" label="Desktop" />
<Area dataKey="mobile" fill="var(--chart-2)" label="Mobile" />
<XAxis />
<YAxis />
<ChartTooltip />
</AreaChart>AreaChart: Holds the rows, sizes the plot and draws everything inside it.Grid: Horizontal and vertical guide lines.Area: One series: a fill down to the baseline and a line along its top.PatternArea: A hatch, dots or another pattern inside a series' area.XAxis: Date labels along the bottom.YAxis: Value labels, one axis peryAxisId.ChartTooltip: The crosshair, the dots, the date pill and the panel.
Fill and fade
An Area fades from fillOpacity (0.4) at the top to gradientToOpacity (0) at the baseline. Raise the first and the fill gets heavier. Set showLine={false} to drop the top line.
fadeBottom={60} keeps the fill flat and fades only its bottom 60%. fadeEdges fades both ends of the series out toward the edges of the plot.
Gradients and patterns
fill accepts url(#id). Put a <LinearGradient> with a few stops inside the chart and point the area at it.
For hatching or dots, add a <PatternArea> with a patternPreset such as "diagonal" or "dots", then an Area on the same dataKey with fillOpacity={0}. The pattern fills the shape and the Area draws the line and the tooltip row.
Two scales
Give an Area a yAxisId and add a <YAxis> with the same id and orientation="right". Each axis scales to its own series, so sessions and a conversion rate can share the date axis.
Widen margin on both sides to fit the two sets of labels.
Forecasts and targets
dashFromIndex turns the top line dashed from that row on, which reads as an estimate. showMarkers puts a dot on every row.
<ReferenceArea y1={180} y2={240} /> shades a target range across the plot. With x1 and x2 instead, it shades a stretch of dates, such as a launch week.
Weekends and deadlines
<Weekends /> stripes Saturdays and Sundays behind the data. Pass weekendDays={[5, 6]} where the weekend falls on Friday and Saturday.
<Deadline date={dueDate} /> draws a line at a date and stripes everything after it in --chart-negative. fillType switches the shading between "pattern", "gradient" and "solid".
Values on the chart
showValue writes values above a few points of the series. Every Area with it shares one label count and one collision pass, so two series never print on top of each other. Cap the count with valueLabelMaxCount.
Small multiples
Render one AreaChart per region with the same syncId and they share a cursor: hover a week in one panel and every panel shows it. syncY puts them all on one y scale, so a peak in one panel compares directly with the others.
Large data
Past about 50,000 rows a series, pass renderer={canvasRenderer} to each <Area>: its fill and line paint on one canvas while the grid, axes and tooltip stay SVG. The fill then reaches the plot's edges, since fadeEdges is an SVG mask.
Customization
The kit is in your project, in components/ui/charts/: your framework's components over a shared core/. Change a default there and every chart picks it up.
className goes on the chart's container, so size and spacing are utility classes.
The axes and the tooltip read dates by default. For sprints, quarters or anything else that isn't a date, pass one string per row to XAxis as labels and the same array to ChartTooltip as dateLabels.
The curve is a prop too: curve={curveStepAfter} on an Area holds each value until the next one. The kit re-exports d3's curves, so you don't need d3-shape in your own imports.
<AreaChart data={data}>
<Area dataKey="points" label="Story points" />
<XAxis labels={sprints} />
<ChartTooltip dateLabels={sprints} />
</AreaChart>Where a part renders content of its own, you pass it in. In React:
ChartTooltip:content={({ point, index }) => …}
Loading state
Pass status="loading" while the rows load. The area turns into a skeleton over a shimmering grid and ignores the pointer, and switching to "ready" reveals the data on the same chart.
loadingStyle on the Area picks the animation, a traveling "pulse" or a diagonal "sweep". With no data at all yet, render <AreaChartLoading /> in the chart's place.
Animation
The areas are revealed from left to right over animationDuration, 1100 ms by default. Set it to 0 to skip the entrance, or pass animationEasing for another curve.
Changing data doesn't replay it. The paths redraw in place and the y scale eases to its new range over yDomainTweenDuration (500 ms). Change revealSignature when you do want the entrance again.
With reduced motion on, the chart draws its final frame.
Theming
Every color in the kit is one of your theme's tokens or a mix of them, except --chart-positive, a fixed green. A preset or the .dark class restyles the chart, and overriding a token in your CSS changes it everywhere.
An Area takes its color from fill and its top line from stroke. Set one and the other follows. With neither, the area uses --chart-line-primary.
| Token | Default | Paints |
|---|---|---|
--chart-1 | your theme's | the first series |
--chart-2 | your theme's | the second series |
--chart-line-primary | --chart-1 | a series with no color of its own |
--chart-line-secondary | --chart-2 | the second default series color |
--chart-grid | --border | grid lines |
--chart-label | --muted-foreground | tick labels |
--chart-crosshair | --muted-foreground at 75% | the hover line |
--chart-tooltip-background | --popover | the tooltip panel |
--chart-date-pill-background | --primary | the date pill on hover |
:root {
--chart-line-primary: var(--chart-3);
--chart-grid: var(--muted);
}Accessibility
The chart is announced as an image named by ariaLabel ("Area chart" by default). Put the takeaway in ariaDescription, since the size of a fill says nothing to a screen reader.
- Tab
- Moves focus to the chart.
- Arrow Right
- Moves to the next row. ArrowDown does the same.
- Arrow Left
- Moves to the previous row. ArrowUp does the same.
- Home
- Jumps to the first row.
- End
- Jumps to the last row.
FAQ
When should I use an area chart instead of a line or stream chart?
Use an area chart when the amount itself is the point. The fill gives the series weight, so a reader sees volume where a line only shows direction.
It works best with a few series, because every <Area> fills down to the same baseline and the fills overlap. Pick a line chart for many series, a stream chart when the series are parts of a total and should stack, and a bar chart to compare separate categories.
What data does the area chart need?
An array of rows, one per point in time. Each row holds a Date under date, or under the key you pass as xDataKey, and one number for each series. A timestamp works in place of a Date.
An <Area> reads its series with dataKey and names it in the tooltip with label. Another series is one more key on the rows and one more <Area>.
How do I make a stacked area chart?
<AreaChart> doesn't stack its series. Every <Area> is drawn from the baseline, so two series overlap and the translucent fills show one through the other.
For areas that sit on top of each other, use the stream chart with offset="none": it stacks one layer per series from zero. offset="expand" stretches every date to 100% when you want shares instead of totals.
How do I give an area chart a gradient or a pattern fill?
By default the fill fades from fillOpacity (0.4) under the line to gradientToOpacity (0) at the baseline. For your own colors, put a <LinearGradient> with an id and a few <stop> elements inside the chart and pass fill="url(#id)" to the <Area>.
For hatching or dots, add a <PatternArea> with a patternPreset such as "diagonal" or "dots", then an <Area> on the same dataKey with fillOpacity={0}. The pattern fills the shape while the <Area> draws the line and the tooltip row.
How do I show two series with different units on one area chart?
Give the second <Area> a yAxisId and add a <YAxis> with the same id and orientation="right". Each axis scales to its own series, so sessions and a conversion rate can share the date axis.
Widen margin on both sides to fit the two sets of labels, and pass formatValue to each <YAxis> so its ticks carry their unit.
Can an area chart label its x axis with sprints or quarters instead of dates?
Yes. Pass one string per row to <XAxis> as labels and the same array to <ChartTooltip> as dateLabels. The axis ticks and the date pill then show your text, such as sprint or quarter names.
The rows still hold a date under xDataKey, which places each point along the axis. When you only want another date format, pass formatValue to <XAxis> instead.
How do I mark a target range or a forecast on an area chart?
<ReferenceArea y1={180} y2={240} /> shades the band between two values across the plot. With x1 and x2 instead, it shades a stretch of dates, such as a launch week.
For a forecast, set dashFromIndex on the <Area> and its top line turns dashed from that row on. <TrendLine dataKey="visits" /> adds a least-squares line fitted to one series.
How do I set the y axis range of an area chart?
With no negative values, the y axis runs from zero to about 10% above the highest value, rounded to even ticks, so the fill stands on a true baseline.
To set it yourself, pass yDomains, an object keyed by axis id: { left: [0, 500] } fixes the default axis, and a function such as ([, max]) => [0, max * 2] adjusts the automatic range. Define the object outside the component so it isn't rebuilt on every render.
On a chart with one axis, yScaleDomainMax is the short form: the axis then runs from zero to 10% above that value.
Which frameworks does the area chart support?
React, Vue, Svelte and Solid. One core on TanStack Charts draws the area chart in each, so the components and props on this page are the same everywhere, and switching framework at the top of the page changes the preview, the code and the install command.
Only the spelling follows the framework: class for className outside React, scoped slots for render props in Vue and snippets in Svelte.
How do I add the area chart to my project?
Sign in, then copy the command under Installation: npx shadcn@latest add with the chart's URL. It adds the example at the top of this page as components/charts/chart-area-default, the chart kit to components/ui/charts the first time you install a chart, and @tanstack/charts.
Both are source files in your project from then on. Swap the sample rows for your own data and change whatever you need.
Is the area chart free?
Yes. The area chart and every example of it are free to use in personal and commercial projects. Seeing the code and installing it takes a free account, one tap with Google or GitHub.
The charts are bklit's (bklit-ui, MIT), rebuilt on TanStack Charts and drawn in your shadcn/ui theme's tokens.
API reference
AreaChart
dataChartDatum[]
The rows to plot. Each row is an object holding the x value under xDataKey and one number per series under that series' dataKey.
xDataKey?string
Key of the x value in each row. The value must be a Date (or something new Date() accepts, such as a timestamp).
- Default
"date"
status?ChartStatus
"loading" shows the loading state (skeleton area, grid shimmer, optional label) and ignores the pointer; switching to "ready" reveals the real data on the same chart instance.
- Default
"ready"
animationDuration?number
Duration of the entrance reveal in milliseconds. 0 skips the animation.
- Default
1100
margin?Partial<ChartMargin>
Space around the plot area in pixels, for axis labels and the tooltip. Missing sides use the default.
- Type
Partial<ChartMargin>- Default
{ top: 40, right: 40, bottom: 40, left: 40 }
aspectRatio?string
CSS aspect ratio of the chart ("width / height" or a number), applied to the container width.
- Default
"2 / 1"
className?string
Extra CSS class name for the chart container.
onPhaseChange?(phase: ChartPhase) => void
Called with "loading" or "ready" when status changes (and once on mount).
- Type
(phase: ChartPhase) => void
childrenReactNode
The layers to draw: Grid, Area, XAxis, YAxis, ChartTooltip and the other chart children.
loadingLabel?string
Text shown centered over the chart, with a shimmer, while status is "loading". Nothing is shown when it is unset or empty.
style?CSSProperties
Inline styles for the chart container, for example a fixed height for a brush strip.
animationEasing?string
CSS easing of the entrance reveal (a cubic-bezier(…), linear, ease-in-out…). enterTransition takes priority.
- Default
"cubic-bezier(0.85, 0, 0.15, 1)"
yDomainTween?boolean
Animate the y domain when the data or status changes instead of jumping to the new scale.
- Default
true
yDomains?Readonly<Record<string, YDomainOverride>>
Per-axis y-domain overrides, keyed by yAxisId ("left" for the default axis): a fixed [min, max], or a function of the auto domain (before it is niced) that returns the one to use, e.g. { left: ([, max]) => [0, max * 3] }. Hoist the object out of render.
- Type
Readonly<Record<string, YDomainOverride>>
yDomainTweenDuration?number
Duration in milliseconds of the y-domain tween (a data update, the loading to ready handoff, a brushed window).
- Default
500
xDomain?[Date, Date]
Visible x range as [start, end], used for brush zoom. The chart plots only this range of data.
xDomainSlotCount?number
Length of the full dataset while xDomain zooms into part of it. It keeps the x spacing consistent with the unzoomed chart.
enterTransition?EnterTransition
The entrance reveal as a motion transition: its duration (seconds) and ease (a cubic-bezier array or a CSS easing) override animationDuration and animationEasing. A reveal is always a tween.
yScaleDomainMax?number
Fixed top of the y domain on a single-axis chart: the domain becomes [0, yScaleDomainMax × 1.1] (niced) instead of following the data, leaving headroom above the series or keeping several charts on one scale.
revealSignature?string
Changing this string replays the entrance animation. Do not change it when only the data changes.
ariaLabel?string
Accessible name of the chart.
- Default
"Area chart"
ariaDescription?string
Longer accessible description of the chart, exposed as aria-description.
syncId?string
Charts with the same syncId move together: hovering or keyboard-focusing one shows the crosshair, dots and date pill at the same date on the others (the same category, for bar charts), and a ChartBrush or ChartZoom in a time chart zooms the time charts of the group to its window.
syncY?boolean
With syncId: every chart of the group draws on one y scale (the union of their data), so small multiples compare at a glance. Read by LineChart and AreaChart.
- Default
false
activeIndex?number | null
Index into data of the row to focus (crosshair, dots and tooltip), for example the row a table has under the pointer. null clears it.
- Type
number | null
onActiveIndexChange?(index: number | null) => void
Called with the index into data of the row the pointer or keyboard focuses, and with null when the focus leaves.
- Type
(index: number | null) => void
Area
dataKeystring
Key of the data field that holds this area's y values.
label?string
Name of the series in the default tooltip row and the chart context's \lines\ (what a legend built from them reads). Defaults to \dataKey\.
stroke?string
Color of the area's top line. Falls back to fill, then to the default line color.
- Default
"var(--chart-line-primary)"
strokeWidth?number
Stroke width of the top line in px.
- Default
2
fill?string
Fill color of the area. Defaults to the resolved stroke.
fillOpacity?number
Opacity of the fill at the top of the area, before the gradient fades it toward gradientToOpacity.
- Default
0.4
curve?CurveFactory
d3-shape curve factory used to interpolate between points.
- Default
curveMonotoneX
yAxisId?string | number
Id of the y scale this area is plotted against.
- Type
string | number- Default
"left"
showLine?boolean
Draw the stroke line along the top of the area.
- Default
true
gradientToOpacity?number
Fill opacity at the bottom of the vertical gradient.
- Default
0
gradientSpan?number
Vertical extent of the fill gradient (0 to 1): 1 fades across the area's full height, lower values reach gradientToOpacity sooner, nearer the top.
- Default
1
fadeBottom?number
Fade the fill out over the bottom N% of the area's height (0 to 100): 100 fades across the full height, 0 keeps the fill flat. Replaces gradientToOpacity and gradientSpan when set.
showValue?boolean
Show the value above sampled points, as text labels that share one count and one collision pass across every Area that shows them, stay inside the plot and skip what does not fit.
- Default
false
valueLabelMinCount?number
Preferred minimum number of value labels per series; the room and collisions can lower it.
- Default
2
valueLabelMaxCount?number
Maximum number of value labels per series. 0 hides them all. Defaults to what the plot width allows.
valueLabelFormatter?(value: number) => string
Formats a value label. Defaults to an English integer such as 12,400.
- Type
(value: number) => string
valueLabelColor?string
Color of the value labels. Defaults to the series stroke.
fadeValueLabels?boolean
Fade the value labels with the series' fadeEdges.
- Default
false
fadeEdges?FadeEdges
Fade the area toward transparent at the chart edges. true fades both ends, "left" or "right" fades one side, and { left, right } sets each side's fade zone as a percentage of the plot width (0-50).
- Default
false
showMarkers?boolean
Draw a circle marker at every data point.
- Default
false
markers?Readonly<SeriesPointMarkerStyle>
Styling of the point markers drawn by showMarkers. See SeriesPointMarkerStyle.
- Type
Readonly<SeriesPointMarkerStyle>
showHighlight?boolean
Draw a highlighted segment of the top line around the hovered point.
- Default
true
dashFromIndex?number
Data index from which the top line is drawn dashed (inclusive).
dashArray?string
Dash pattern of the dashed tail when dashFromIndex is set.
- Default
"6,4"
animate?boolean
Whether the point markers animate in. The area itself always enters with the chart's animationDuration.
- Default
true
loading?boolean
Show the loading pulse overlay on this area. When unset, the pulse follows the chart's status. Set false to disable it.
loadingStroke?string
Stroke color of the loading pulse overlay.
- Default
"var(--chart-foreground)"
loadingStrokeOpacity?number
Stroke opacity of the loading pulse overlay.
- Default
0.5
loadingPulseMode?LineLoadingPulseMode
Phase of the loading pulse: "loop" repeats, "exit" plays the loading to ready transition, "enter" plays ready to loading.
- Default
"loop"
loadingStyle?LoadingStyle
Loading animation: a travelling "pulse" or a diagonal "sweep" shimmer.
- Default
"pulse"
renderer?ChartMarkRenderer
Where the area's fill and line draw: "svg", paths, or canvasRenderer, a bitmap the chart's canvas series share, for tens of thousands of points (the grid, axes, hover highlight, markers, crosshair and tooltip stay SVG). On a canvas the area dims with the others on hover (a legend can't dim it alone) and its fill draws to the plot's edges (fadeEdges is an SVG mask).
- Default
"svg"
PatternArea
dataKeystring
Key of the data field that holds the y values filled with the pattern.
label?string
Name of the series in the default tooltip row, when no \Area\ or \Line\ with the same \dataKey\ names it. Defaults to \dataKey\.
patternPreset?PatternPresetId
Pattern drawn inside the area (a PatternPresetId, for example "diagonal", "dots" or "cross").
- Default
"diagonal"
patternColor?string
Color of the pattern strokes. Defaults to fill, then to the default line color.
fill?string
Fallback color for the pattern when patternColor is not set.
curve?CurveFactory
d3-shape curve factory used to interpolate between points.
- Default
curveMonotoneX
fillOpacity?number
Opacity of the pattern.
- Default
1
fadeBottom?number
Fade the pattern out over the bottom N% of the area's height (0 to 100).
fadeEdges?FadeEdges
Fade the pattern toward transparent at the chart edges: true both, "left" or "right" one side. Pair it with the same fadeEdges on the stroke Area.
- Default
false
animate?boolean
Deprecated. The pattern fill does not animate, so this has no effect.
Grid
horizontal?boolean
Show horizontal grid lines.
- Default
true
vertical?boolean
Show vertical grid lines.
- Default
false
numTicksRows?number
Number of horizontal grid lines. Ignored when rowTickValues is set.
- Default
5
numTicksColumns?number
Number of vertical grid lines.
- Default
10
rowTickValues?number[]
Explicit y values for the horizontal grid lines. Overrides numTicksRows.
stroke?string
Color of the grid lines.
- Default
"var(--chart-grid)"
loadingStroke?string
Grid color while the chart is loading. Falls back to stroke.
strokeOpacity?number
Opacity of the grid lines.
- Default
1
strokeWidth?number
Width of the grid lines in px.
- Default
1
strokeDasharray?string
Dash pattern of the grid lines.
- Default
"4,4"
highlightRowValues?number[]
Y values of horizontal lines drawn with the highlight styling, for example a zero baseline.
highlightRowStroke?string
Color of the highlighted rows.
- Default
"var(--chart-foreground-muted)"
highlightRowStrokeOpacity?number
Opacity of the highlighted rows.
- Default
1
highlightRowStrokeWidth?number
Width of the highlighted rows in px.
- Default
1
highlightRowStrokeDasharray?string
Dash pattern of the highlighted rows.
- Default
"0"
fadeHorizontal?boolean
Fade the horizontal lines toward transparent at the left and right edges.
- Default
true
fadeVertical?boolean
Fade the vertical lines toward transparent at the top and bottom edges.
- Default
false
hideHorizontalEdgeLines?boolean
Drop the first and last horizontal line (kept when two or fewer remain).
- Default
false
hideVerticalEdgeLines?boolean
Drop the first and last vertical line (kept when two or fewer remain).
- Default
false
shimmer?boolean
While the chart is loading, sweep a bright band across the grid.
- Default
false
shimmerStroke?string
Color of the shimmer band.
- Default
"color-mix(in oklch, var(--bkm-foreground) 68%, transparent)"
shimmerSpeed?number
Speed multiplier of the shimmer sweep. 2 is twice as fast.
- Default
1
XAxis
numTicks?number | ResponsiveChartLabelCount
Target number of tick labels along the x axis, or one per chart width: { base, sm, md, lg, xl } takes the count of the widest breakpoint the chart reaches (640, 768, 1024 and 1280 px).
- Type
number | ResponsiveChartLabelCount- Default
5
labels?readonly string[]
The tick text of each data row, in row order: it replaces the date formatting (pair it with ChartTooltip dateLabels).
tickerHalfWidth?number
Half-width in px of the zone around the date pill inside which tick labels are hidden. Line, area and composed charts widen it to the pill's half-width plus the widest tick label's, so no label sits half under the pill.
- Default
50
tickMode?"domain" | "data"
Where ticks fall: "data" places them on evenly spaced data rows, "domain" places them at evenly spaced time values across the x domain.
- Type
"domain" | "data"- Default
"data"
formatValue?(value: Readonly<Date>) => string
Formats a tick date into its label. Defaults to a short month and day such as "Jan 5".
- Type
(value: Readonly<Date>) => string
YAxis
yAxisId?string | number
Id of the y scale this axis labels. Must match the yAxisId of the series that use it.
- Type
string | number- Default
"left"
orientation?"left" | "right"
Side of the plot the axis sits on. The primary axis is on the left; additional axes default to the right.
- Type
"left" | "right"- Default
"left"
numTicks?number
Target number of tick labels. The primary axis also sets the number of horizontal grid lines.
- Default
5
formatLargeNumbers?boolean
Abbreviate values of 1000 and above as thousands, with one decimal where needed, for example 2k or 1.5k.
- Default
true
formatValue?(value: number) => string
Formats a tick value into its label. Overrides formatLargeNumbers.
- Type
(value: number) => string
ChartTooltip
showDatePill?boolean
Show the date pill that rides along the bottom of the plot.
- Default
true
showCrosshair?boolean
Show the vertical crosshair line. Bar charts leave it off unless this is true (the dots and the category pill mark the bar).
- Default
true
showDots?boolean
Show a dot on every series at the hovered position.
- Default
true
dotVariant?"dot" | "ring"
Dot style: a filled "dot" or a transparent "ring" square. Read by BarChart only.
- Type
"dot" | "ring"- Default
"dot"
dotSize?number
Dot radius in px.
- Default
5
dotRadiusFraction?number
Corner radius of the "ring" variant as a fraction of its side (0 is square, 0.5 is a circle). Read by BarChart only.
- Default
0.25
dotScale?number
Multiplier applied to the dot or ring size. Read by BarChart and LiveLineChart.
- Default
1
dotStrokeWidth?number
Stroke width of the dots in px.
- Default
2
indicatorColor?string | ((point: Record<string, unknown>) => string)
Color of the crosshair. Only a string is applied; the function form that bklit-ui accepts is ignored and the default is used.
- Type
string | ((point: Record<string, unknown>) => string)- Default
"var(--chart-crosshair)"
content?(props: { point: Record<string, unknown>; index: number; pinned?: boolean; dismiss?: () => void }) => ReactNode
Replaces the default tooltip panel body. Receives the hovered data row and its index; with pinnable, also whether the panel is pinned and a dismiss that unpins it (for a close button in a pinned panel's detail).
- Type
(props: { point: Record<string, unknown>; index: number; pinned?: boolean; dismiss?: () => void }) => ReactNode
pinnable?boolean
A click (or Enter, or Space) on the chart pins the tooltip where it is: the panel takes the pointer, so its content can grow into detail and hold controls, until another click, Escape or dismiss lets it go.
- Default
false
rows?(point: Record<string, unknown>) => { readonly color: string; readonly label: string; readonly value: string | number }[]
Replaces the default rows (one per series) with your own list of { color, label, value }.
- Type
(point: Record<string, unknown>) => { readonly color: string; readonly label: string; readonly value: string | number }[]
dotColor?string | ((point: Record<string, unknown>, line: ChartLineConfig) => string)
Fill of the tooltip dots. A function receives the hovered row and the series config, and is called again each time the hovered row changes. Defaults to each series' color; a ProfitLossLine's dot takes the color of the hovered value's sign.
- Type
string | ((point: Record<string, unknown>, line: ChartLineConfig) => string)
children?ReactNode
Extra content rendered below the rows in the default panel, for example marker details. Without it, a chart with ChartMarkers lists the markers on the hovered date there.
className?string
Extra class name for the tooltip panel.
springConfig?SpringConfig
Spring for the floating panel when matchCrosshair is on. Defaults to the chart's tooltip spring.
matchCrosshair?boolean
Make the floating panel follow the pointer with the same spring as the crosshair instead of damping.
- Default
false
damping?number
Spring damping for the floating panel when matchCrosshair is off, on bklit's 0 to 100 scale: lower is bouncier, higher slower, 0 moves the panel instantly. The default, 20, is the snappy hover spring (stiffness 3600, damping 120); every other value is bklit's spring for it played six times faster.
- Default
20
indicatorDasharray?string
Dash pattern of the crosshair. Omit for a solid line.
indicatorFadeEdges?IndicatorFadeEdges
Vertical fade of the crosshair: both ends, the top, the bottom, or none (solid).
- Default
"both"
indicatorFadeLength?number
Size of the crosshair's fade, as a percentage of its height (2 to 40).
- Default
10
indicatorEndColor?string
Bottom colour of the crosshair: it ramps from indicatorColor at the top to this at the bottom (composes with the fade).
indicatorEnd?"plot" | "point"
How far down the crosshair reaches: the whole plot, or down to the hovered point of the first series.
- Type
"plot" | "point"- Default
"plot"
dotHaloBlur?number
Blur in px on the dots' halo, for a soft glow.
- Default
0
topOffset?number
Extra gap in px between the top of the plot and the tooltip panel.
- Default
0
dateLabels?readonly string[]
The date pill's text for each data row, in row order (pair it with XAxis labels).
boxSpringConfig?SpringConfig
Spring for the floating panel. Takes priority over matchCrosshair and damping.
indicatorWidth?IndicatorWidth
Thickness of the crosshair: a width in px, or "line" (1px), "thin" (2px), "medium" (4px) or "thick" (8px).
- Default
"line"
AreaChartLoading
margin?Partial<ChartMargin>
Space around the plot area in pixels. Missing sides use the default.
- Type
Partial<ChartMargin>- Default
{ top: 40, right: 40, bottom: 40, left: 40 }
stroke?string
Color of the traveling loading segment.
- Default
"var(--bkm-foreground)"
strokeOpacity?number
Opacity of the traveling loading segment.
- Default
0.5
gridStroke?string
Color of the grid lines while loading. Use color-mix or an oklch alpha to set the opacity.
- Default
"color-mix(in oklch, var(--chart-grid) 50%, transparent)"
gridShimmerStroke?string
Color of the shimmer band that travels across the grid. Use color-mix or an oklch alpha to set the opacity.
- Default
"color-mix(in oklch, var(--bkm-foreground) 68%, transparent)"
gridShimmer?boolean
Animate a shimmer band across the grid lines. Always off when loadingStyle is "sweep".
- Default
true
gridShimmerSpeed?number
Shimmer speed multiplier; higher is faster.
- Default
1
loadingStyle?LoadingStyle
Loading animation: "pulse" sends a bright segment along the line, "sweep" sweeps a soft diagonal shimmer across it.
- Default
"pulse"
label?string
Text shown centered over the placeholder, with a shimmer. An empty string hides it.
- Default
"Loading"
aspectRatio?string
CSS aspect ratio of the placeholder, as "width / height".
- Default
"2 / 1"
className?string
Extra CSS class name for the placeholder container.
- Default
""
Examples
20 examples on React, each live with its code and its own install command.
- Area ChartArea chart

- Area Chart with Gradient FillArea chart

- Fill-Only Area ChartArea chart

- Hatched Area ChartArea chart

- Area Chart with Mixed FillsArea chart

- Area Chart with ForecastArea chart

Related chart types
Charts close to the area chart: the same data drawn another way, or the type to reach for when this one stops fitting.





