Area Chart

An area chart for visualizing trends with gradient fills, stacked series, and sparkline variants.

Usage

Monthly Revenue

"use client";

import { AreaChart } from "@thenamespace/uikit";
import { Card } from "@thenamespace/uikit/card";
import { ChartTooltip } from "@thenamespace/uikit/chart-tooltip";

Anatomy

Import the AreaChart component and access all parts using dot notation.

import { AreaChart } from "@thenamespace/uikit";

<AreaChart>
  <AreaChart.Grid />
  <AreaChart.XAxis />
  <AreaChart.YAxis />
  <AreaChart.Area />
  <AreaChart.Tooltip />
</AreaChart>;

Custom Tooltip

Sessions

Organic
Paid Ads
"use client";

import { AreaChart } from "@thenamespace/uikit";
import { Card } from "@thenamespace/uikit/card";
import { ChartTooltip } from "@thenamespace/uikit/chart-tooltip";

KPI With Area Chart

Total Revenue
$228,451
3.3% last 30d
Bounce Rate
42.3%
5.9% vs last 7d
Active Users
98K
10.9% this month
"use client";

import { AreaChart } from "@thenamespace/uikit";
import { KPI } from "@thenamespace/uikit/kpi";
import { TrendChip } from "@thenamespace/uikit/trend-chip";

Multi Area

Traffic Sources

Organic
Paid Ads
231,856Sessions
"use client";

import { AreaChart } from "@thenamespace/uikit";
import { Card } from "@thenamespace/uikit/card";

Sparkline

Revenue
Churn
Users
"use client";

import { AreaChart } from "@thenamespace/uikit";

const sparkUp = [30, 35, 28, 42, 38, 45, 50, 48, 55, 60, 58, 65].map(

Stacked

Traffic Breakdown

Organic
Paid Ads
Referral
Direct
"use client";

import { AreaChart } from "@thenamespace/uikit";
import { Card } from "@thenamespace/uikit/card";

CSS Classes

Element Classes

  • .area-chart — Root container wrapping ResponsiveContainer and the Recharts chart.

Recharts Theming

The following CSS rules target Recharts internal class names to apply Namespace UIKit design tokens automatically:

  • .area-chart .recharts-cartesian-axis-tick-value — Axis tick labels. 10px muted text.
  • .area-chart .recharts-cartesian-axis-line — Axis lines. Hidden by default.
  • .area-chart .recharts-cartesian-axis-tick-line — Tick lines. Hidden by default.
  • .area-chart .recharts-cartesian-grid line — Cartesian grid lines. Muted stroke at 0.15 opacity.
  • .area-chart .recharts-tooltip-cursor — Tooltip cursor. Dashed vertical line on hover.
  • .area-chart .recharts-active-dot circle — Active dot. Outlined with surface color for contrast.

API Reference

AreaChart

The root wrapper. Renders a ResponsiveContainer + Recharts AreaChart with Namespace UIKit CSS theming applied automatically.

PropTypeDefaultDescription
dataRecord<string, number | string>[]Chart data — array of objects with numeric/string fields for each series.
heightnumber300Chart height in pixels.
widthnumber | `${number}%` "100%"Chart width in pixels or percentage string.
margin{ top?: number; right?: number; bottom?: number; left?: number }{ top: 8, right: 8, bottom: 0, left: 0 }Recharts margin around the chart area.
childrenReactNodeRecharts child components (AreaChart.Area, AreaChart.XAxis, etc.).

Also supports all native div HTML attributes.

AreaChart.Area

Re-exported Recharts Area component. Follows the Recharts Area API.

AreaChart.XAxis

Re-exported Recharts XAxis component. Follows the Recharts XAxis API.

AreaChart.YAxis

Re-exported Recharts YAxis component. Follows the Recharts YAxis API.

AreaChart.Grid

Re-exported Recharts CartesianGrid component. Follows the Recharts CartesianGrid API.

AreaChart.Tooltip

Re-exported Recharts Tooltip component. Follows the Recharts Tooltip API. Use with AreaChart.TooltipContent for styled tooltips.

AreaChart.TooltipContent

Pre-built tooltip renderer for Recharts. Pass as the content prop of AreaChart.Tooltip. See ChartTooltip for full props.