AreaChart
Area chart component for visualizing quantity changes over time — supports solid and gradient fill styles, stacked areas, and multiple series.
Playground
<Chart config={chartConfig} className="min-h-[200px]">
<AreaChart accessibilityLayer data={chartData}>
<CartesianGrid vertical={false} />
<Chart.XAxis dataKey="month" tickLine={false} tickMargin={10} axisLine={false} />
<Chart.Tooltip content={<Chart.TooltipContent />} />
<Chart.Legend content={<Chart.LegendContent />} />
<Chart.Area dataKey="desktop" fill="var(--color-desktop)" stroke="var(--color-desktop)" />
<Chart.Area dataKey="mobile" fill="var(--color-mobile)" stroke="var(--color-mobile)" />
</AreaChart>
</Chart>JSX Composition
Chart.* from this library, and other components from Recharts.
<CartesianGrid /><Chart.YAxis /><Chart.Legend /><LabelList />Patterns
Main display patterns for AreaChart — choose based on your use case.
Default
Basic area chart with a single series
Multiple Areas
Overlay multiple series for comparison
Stacked
Stack multiple series to visualize totals
Gradient
Deep visual expression with gradient fill
Tooltip Styles
Use the indicator prop on Chart.TooltipContent to change the tooltip indicator shape.
Dot (default)
Default dot indicator
indicator="dot"Line
Vertical line indicator
indicator="line"Dashed
Dashed line indicator
indicator="dashed"API
Component Structure
Chart— Recharts.AreaPropsArea (type · variant · dot · fillOpacity).XAxisX-axis.YAxisY-axis.TooltipTooltip wrapper.TooltipContentPropsTooltip content.LegendLegend wrapper.LegendContentLegend contentProps
Chart
config—ChartConfigChart configuration object (label and color definitions)
children—ReactElementRecharts chart component
idundefinedstringUnique chart ID — used for CSS variable scoping
hoverFadefalsebooleanEnables highlight effect — hovered series shown at full color, others faded out
| Name | Type | Default | Description |
|---|---|---|---|
config | ChartConfig | — | Chart configuration object (label and color definitions) |
children | ReactElement | — | Recharts chart component |
id | string | undefined | Unique chart ID — used for CSS variable scoping |
hoverFade | boolean | false | Enables highlight effect — hovered series shown at full color, others faded out |
Chart.Area
type"monotone""linear" | "monotone" | "step" | "natural"Curve interpolation method
variant"solid""solid" | "gradient"Fill style — "gradient" auto-generates an SVG linearGradient
dottruebooleanShow dots at data points
activeDottruebooleanShow highlighted dot on hover
fillOpacity0.4numberArea opacity (0–1) — ignored for gradient variant
| Name | Type | Default | Description |
|---|---|---|---|
type | "linear" | "monotone" | "step" | "natural" | "monotone" | Curve interpolation method |
variant | "solid" | "gradient" | "solid" | Fill style — "gradient" auto-generates an SVG linearGradient |
dot | boolean | true | Show dots at data points |
activeDot | boolean | true | Show highlighted dot on hover |
fillOpacity | number | 0.4 | Area opacity (0–1) — ignored for gradient variant |
Chart.TooltipContent
indicator"dot""dot" | "line" | "dashed"Indicator shape
hideLabelfalsebooleanHide the label
hideIndicatorfalsebooleanHide the indicator
colorundefinedstringDirectly sets indicator color — falls back to payload color if not set
labelClassNameundefinedstringCSS class added to the label element
nameKeyundefinedstringName mapping for data key
labelKeyundefinedstringMapping for label key
labelFormatterundefined(value, payload) => ReactNodeCustom label formatter
formatterundefined(value, name, item, index, payload) => ReactNodeCustom value formatter
| Name | Type | Default | Description |
|---|---|---|---|
indicator | "dot" | "line" | "dashed" | "dot" | Indicator shape |
hideLabel | boolean | false | Hide the label |
hideIndicator | boolean | false | Hide the indicator |
color | string | undefined | Directly sets indicator color — falls back to payload color if not set |
labelClassName | string | undefined | CSS class added to the label element |
nameKey | string | undefined | Name mapping for data key |
labelKey | string | undefined | Mapping for label key |
labelFormatter | (value, payload) => ReactNode | undefined | Custom label formatter |
formatter | (value, name, item, index, payload) => ReactNode | undefined | Custom value formatter |
Chart.LegendContent
hideIconfalsebooleanHide the icon
nameKeyundefinedstringName mapping for data key
verticalAlign"bottom""top" | "middle" | "bottom"Vertical position — auto-injected from Recharts Legend
align"center""left" | "center" | "right"Horizontal position — auto-injected from Recharts Legend
layout"horizontal""horizontal" | "vertical"Layout direction — auto-injected from Recharts Legend
| Name | Type | Default | Description |
|---|---|---|---|
hideIcon | boolean | false | Hide the icon |
nameKey | string | undefined | Name mapping for data key |
verticalAlign | "top" | "middle" | "bottom" | "bottom" | Vertical position — auto-injected from Recharts Legend |
align | "left" | "center" | "right" | "center" | Horizontal position — auto-injected from Recharts Legend |
layout | "horizontal" | "vertical" | "horizontal" | Layout direction — auto-injected from Recharts Legend |
Chart.XAxis / Chart.YAxis
tick{ style: { fontSize, fill } }objectAxis label style — applies design tokens by default (--font-size-2xs, --color-text-subtle). Override with a custom object
width (YAxis)"auto"number | "auto"Y-axis width — "auto" adjusts to data. Pass a number for fixed width
...props—XAxisProps | YAxisPropsAll Recharts XAxis / YAxis props are accepted
| Name | Type | Default | Description |
|---|---|---|---|
tick | object | { style: { fontSize, fill } } | Axis label style — applies design tokens by default (--font-size-2xs, --color-text-subtle). Override with a custom object |
width (YAxis) | number | "auto" | "auto" | Y-axis width — "auto" adjusts to data. Pass a number for fixed width |
...props | XAxisProps | YAxisProps | — | All Recharts XAxis / YAxis props are accepted |
Anatomy
Best Practices
Do
- ✓Centralize labels and colors via ChartConfig
- ✓Always enable accessibilityLayer
- ✓Use the same stackId for stacked areas
- ✓Use gradient for visual depth
Don't
- ✗Don't use hardcoded color values directly
- ✗Don't place a chart without a container size
- ✗Don't pack more than 5 series into one chart
- ✗Don't increase fill opacity too much in stacked charts — overlapping areas become invisible
Accessibility
Keyboard
ARIA / WCAG
accessibilityLayerkeyboard and screen reader support- Tooltip provides data values as text
- Legend identifies series
- Color tokens automatically support dark mode