suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
  • AI
GitHubCreate
DocsComponentsPatternsInteractionsChartsBlocksAICreate
Charts70
  • Overview
  • Area Chart
  • Bar Chart
  • Line Chart
  • Pie Chart
  • Radar Chart
  • Radial Chart
  • Tooltip Chart

suiss/ui ยท Chart

Area Chart

Ten area charts for showing how values change over time, from a single smooth area to stacked, gradient, step, range and sparkline areas.

Area Chart is an open-source chart from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

Area charts show how a value moves over time and how big it is at each point. Use the default for one series, stack areas to show a total and its parts, expand them to 100% to compare shares, and switch to linear or step lines when the readings should not look smoothed. The range variant shades a low-to-high band, and the sparkline fits a tiny trend beside a value.

Each chart is built on the Chart and Card components.

Every variant below is its own registry item, so you can add only the ones you need. Each one renders the same design on React, React Native, SwiftUI and Jetpack Compose.

Default

A single filled area with a smooth curve showing one series across six months.

components/charts/area-chart-default.tsx
"use client"

import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,

The baseline area chart: one series as a smooth, lightly filled curve with a month axis and a tooltip, and no value axis. Start here when you only need the shape of a trend and want to build up from the simplest version.

Replace chartData, point each dataKey at your fields and set the label and color in chartConfig, where colors follow light and dark mode. Change the curve with the type prop on the area, for example to straight lines or steps. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-default

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-default
  1. Install the following dependencies:
$ pnpm add recharts
  1. Add the pieces it builds on: Card, Chart.

  2. Copy and paste the following code into your project.

components/charts/area-chart-default.tsx
  1. Update the import paths to match your project setup.

Usage

import { AreaChartDefault } from "@/components/charts/area-chart-default"
<AreaChartDefault />
Web

Web preview

uniwind/components/charts/area-chart-default.tsx
swift/Charts/AreaChartDefault.swift
kotlin/charts/AreaChartDefault.kt

The baseline area chart inside a Card: one series drawn as a natural curve with a light fill, a dashed horizontal grid, a month axis and a tooltip with a line indicator. There is no value axis. Press and drag across the plot to move the tooltip between months.

Replace chartData with your records and change each dataKey to match your fields. Rename the series in chartConfig to set its label and color. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-default

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-default
$ pnpm dlx shadcn@latest add @esuiss/area-chart-default

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-default --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-default

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-default --platform kotlin

The CLI also adds what it builds on: Card, Chart.

  1. Add the pieces it builds on: Card, Chart.

  2. Copy and paste the following code into components/charts/area-chart-default.tsx:

uniwind/components/charts/area-chart-default.tsx
  1. Update the import paths to match your project setup.
  1. Add the pieces it builds on: Card, Chart.

  2. Copy and paste the following code into components/charts/area-chart-default.tsx:

nativewind/components/charts/area-chart-default.tsx
  1. Update the import paths to match your project setup.
  1. Add the pieces it builds on: Card, Chart.

  2. Copy and paste the following code into components/charts/area-chart-default.tsx:

stylesheet/components/charts/area-chart-default.tsx
  1. Update the import paths to match your project setup.
  1. Target iOS 17 or later.

  2. Copy the theme files every view uses:

swift/Theme/Theme.swift
swift/Theme/Tokens.swift
  1. Copy the source and every file it uses:
swift/Charts/AreaChartDefault.swift
swift/Components/Card.swift
swift/Components/Chart.swift
swift/Components/Haptics.swift
swift/Components/Item.swift
swift/Components/Separator.swift
  1. Add the files to your app target.
  1. Apply the Compose compiler plugin, enable Compose, set compileSdk to 37 or higher and minSdk to 24 or higher, and add the dependencies:
build.gradle.kts
plugins {
    id("org.jetbrains.kotlin.plugin.compose")
}

android {
    compileSdk = 37
    defaultConfig { minSdk = 24 }
    buildFeatures { compose = true }
}

dependencies {
    implementation(platform("androidx.compose:compose-bom:2026.09.00"))
    implementation("androidx.compose.foundation:foundation")
    implementation("androidx.compose.ui:ui")
}
  1. Copy the theme files every view uses:
kotlin/theme/Theme.kt
kotlin/theme/Tokens.kt
  1. Copy the source and every file it uses:
kotlin/charts/AreaChartDefault.kt
kotlin/components/Card.kt
kotlin/components/Chart.kt
kotlin/components/Content.kt
kotlin/components/FormSupport.kt
kotlin/components/Haptics.kt
kotlin/components/Icon.kt
  1. Update the com.esuiss.ui package names to match your project.

Usage

import { AreaChartDefault } from "@/components/charts/area-chart-default"
<AreaChartDefault />
import SwiftUI

struct AreaExample: View {
  var body: some View {
    AreaChartDefault()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartDefault

@Composable
fun AreaExample() {
    AreaChartDefault()
}

Axes

A gradient area with visible dots and a value axis on the right edge of the plot.

components/charts/area-chart-axes.tsx
"use client"

import * as React from "react"
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,

A single series drawn as a smooth area with a soft gradient fill, a dot at every value and a value axis on the right. Use it when readers need to read exact values off the chart, not just see the trend.

Replace chartData, point each dataKey at your fields and set the label and color in chartConfig. Set orientation on the value axis to move it to the left and tickCount to change how many values it shows. Each copy gets its own gradient, so several can share a page. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-axes

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-axes

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartAxes } from "@/components/charts/area-chart-axes"
<AreaChartAxes />
Web

Web preview

uniwind/components/charts/area-chart-axes.tsx
swift/Charts/AreaChartAxes.swift
kotlin/charts/AreaChartAxes.kt

One series drawn as a monotone curve with a fill that fades from top to bottom, a dot on every month, a month axis below and a four-tick value axis on the right. The tooltip follows your finger across the plot.

Replace chartData with your records and change each dataKey to match your fields. Set the label and color in chartConfig, and adjust tickCount on the YAxis to change how many values it shows. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-axes

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-axes
$ pnpm dlx shadcn@latest add @esuiss/area-chart-axes

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-axes --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-axes

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-axes --platform kotlin

The CLI also adds what it builds on: Card, Chart.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartAxes } from "@/components/charts/area-chart-axes"
<AreaChartAxes />
import SwiftUI

struct AreaAxesExample: View {
  var body: some View {
    AreaChartAxes()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartAxes

@Composable
fun AreaAxesExample() {
    AreaChartAxes()
}

Gradient

Two overlapping areas whose fills fade out toward the bottom using SVG linear gradients.

components/charts/area-chart-gradient.tsx
"use client"

import * as React from "react"
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,

Two overlapping series whose fills fade to transparent toward the baseline, so the lower series stays visible through the upper one. Reach for it over the flat-filled default when you compare two series that cross each other.

Replace chartData and rename the two series keys in the data, the areas and chartConfig. Each series needs its own gradient in the defs block, and the top stop's stopOpacity sets the strength of the fill. Areas are drawn in source order, so the last Area sits on top. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-gradient

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-gradient

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartGradient } from "@/components/charts/area-chart-gradient"
<AreaChartGradient />
Web

Web preview

uniwind/components/charts/area-chart-gradient.tsx
swift/Charts/AreaChartGradient.swift
kotlin/charts/AreaChartGradient.kt

Two series, desktop and mobile, drawn as natural curves on the same axis. Both use a shared gradient fill that fades out toward the baseline, so the overlap stays readable. A month axis, a dashed grid and a tooltip listing both values complete the chart.

Replace chartData with your records and change each dataKey to match your fields. Add or rename series in chartConfig, and change the fade stops to make the gradient stronger or lighter. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-gradient

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-gradient
$ pnpm dlx shadcn@latest add @esuiss/area-chart-gradient

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-gradient --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-gradient

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-gradient --platform kotlin

The CLI also adds what it builds on: Card, Chart.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartGradient } from "@/components/charts/area-chart-gradient"
<AreaChartGradient />
import SwiftUI

struct AreaGradientExample: View {
  var body: some View {
    AreaChartGradient()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartGradient

@Composable
fun AreaGradientExample() {
    AreaChartGradient()
}

Interactive

A stock price chart with time-range toggles, a scrubbing cursor that updates the header, and animated transitions between ranges.

components/charts/area-chart-interactive.tsx
"use client"

import * as React from "react"
import {
  Area,
  AreaChart,
  CartesianGrid,
  ReferenceLine,
  useActiveTooltipDataPoints,
  XAxis,
  YAxis,
} from "recharts"

import { Card, CardContent, CardHeader } from "@/components/ui/card"
import {
  type ChartConfig,

A stock-style price chart with range toggles from one day to five years. Scrubbing the plot updates the price, change and date in the header, and switching ranges morphs the line into its new shape. Use it as a starting point for financial or any time-series dashboard where readers drill into time ranges.

Replace the seeded generate function with your own data per range, one price and one label per point, and edit RANGES to change the toggles. The stats row under the chart, including volume, is static. There is no floating tooltip: the header shows every readout and returns to the latest price when a touch ends. The line turns green or red as the price at the cursor is above or below the opening price, and the morph is skipped when reduced motion is preferred.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-interactive

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-interactive

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartInteractive } from "@/components/charts/area-chart-interactive"
<AreaChartInteractive />
Web

Web preview

uniwind/components/charts/area-chart-interactive.tsx
swift/Charts/AreaChartInteractive.swift
kotlin/charts/AreaChartInteractive.kt

One price series drawn as a linear area with a fading gradient, a value axis on the right and a dashed ReferenceLine at the opening price. A ToggleGroup switches between 1D, 1W, 1M, 3M, 1Y and 5Y. Touching the plot reports the point through onActiveIndexChange, and the header updates the price, change and date for that point. The area turns green or red depending on whether the price is up or down, and open, high, low and volume sit below the chart. The area sets isAnimationActive={false}, so it draws without the enter animation and switches ranges instantly.

Replace generate() with your price history for each range, and set the symbol, company name and LAST_PRICE. Volume values are hard-coded in stats. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-interactive

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-interactive
$ pnpm dlx shadcn@latest add @esuiss/area-chart-interactive

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-interactive --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-interactive

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-interactive --platform kotlin

The CLI also adds what it builds on: Card, Chart, Text, Toggle Group.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartInteractive } from "@/components/charts/area-chart-interactive"
<AreaChartInteractive />
import SwiftUI

struct AreaInteractiveExample: View {
  var body: some View {
    AreaChartInteractive()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartInteractive

@Composable
fun AreaInteractiveExample() {
    AreaChartInteractive()
}

Linear

A single filled area whose points are joined by straight segments instead of a smoothed curve.

components/charts/area-chart-linear.tsx
"use client"

import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,

One series filled under straight line segments instead of a smoothed curve. Prefer it to the default when smoothing would suggest values between points that were never measured.

Replace chartData, point each dataKey at your fields and set the label and color in chartConfig. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-linear

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-linear

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartLinear } from "@/components/charts/area-chart-linear"
<AreaChartLinear />
Web

Web preview

uniwind/components/charts/area-chart-linear.tsx
swift/Charts/AreaChartLinear.swift
kotlin/charts/AreaChartLinear.kt

The same one-series area as the default chart, with type="linear" so each month connects to the next with a straight segment. It has a month axis, a dashed grid and a tooltip with a line indicator.

Replace chartData with your records and change each dataKey to match your fields. Set the label and color of the series in chartConfig. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-linear

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-linear
$ pnpm dlx shadcn@latest add @esuiss/area-chart-linear

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-linear --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-linear

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-linear --platform kotlin

The CLI also adds what it builds on: Card, Chart.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartLinear } from "@/components/charts/area-chart-linear"
<AreaChartLinear />
import SwiftUI

struct AreaLinearExample: View {
  var body: some View {
    AreaChartLinear()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartLinear

@Composable
fun AreaLinearExample() {
    AreaChartLinear()
}

Range

A heart-rate band showing each hour's low-to-high range as a shaded area with an average line through it.

components/charts/area-chart-range.tsx
"use client"

import {
  Area,
  CartesianGrid,
  ComposedChart,
  Line,
  XAxis,
  YAxis,
} from "recharts"

import { Card, CardContent, CardHeader } from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,

A health-style heart-rate card that shades each hour's low-to-high range and draws the average as a line through the band. Use it for any metric where the spread matters as much as the typical value, such as temperatures or response times.

Give each record a two-number range array and an average; the header's overall low and high come from the data. The value axis has a fixed domain, so widen it and its ticks if readings fall outside it, and change the unit text in the tooltip and header. Set both colors in chartConfig. Focus the chart and use the arrow keys to move the tooltip between hours.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-range

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-range

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartRange } from "@/components/charts/area-chart-range"
<AreaChartRange />
Web

Web preview

uniwind/components/charts/area-chart-range.tsx
swift/Charts/AreaChartRange.swift
kotlin/charts/AreaChartRange.kt

A ComposedChart that pairs a range Area, filled between each hour's low and high reading, with a Line for the hourly average. The header shows the day's lowest and highest values in BPM, and the tooltip formats both the range and the average with a custom row built from Text.

Replace the readings array with [low, high, average] tuples for each hour; the header range and the chart data are derived from it. Adjust the YAxis domain and ticks to fit your values. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-range

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-range
$ pnpm dlx shadcn@latest add @esuiss/area-chart-range

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-range --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-range

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-range --platform kotlin

The CLI also adds what it builds on: Card, Chart, Text.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartRange } from "@/components/charts/area-chart-range"
<AreaChartRange />
import SwiftUI

struct AreaRangeExample: View {
  var body: some View {
    AreaChartRange()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartRange

@Composable
fun AreaRangeExample() {
    AreaChartRange()
}

Sparkline

A watchlist with a tiny gradient area chart beside each price, colored by whether the stock is rising or falling.

components/charts/area-chart-sparkline.tsx
"use client"

import * as React from "react"
import { Area, AreaChart, YAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import { type ChartConfig, ChartContainer } from "@/components/ui/chart"

const stocks = [
  { symbol: "ACME", name: "Acme Corp.", price: 254.32, change: 1.28, seed: 41 },

A watchlist where each row pairs a stock's name and price with a tiny gradient area chart, tinted green when rising and red when falling. Use sparklines like these inside lists and tables where a full chart would be too much.

Replace the stocks array and the demo series generator with your own symbols and price history. The tint follows the sign of each row's change, with both colors in chartConfig, and the class names on ChartContainer set the size. Sparklines are hidden from assistive technology and have no tooltip or keyboard support, so keep the price and percentage text next to them. Animation is off so long lists render without motion.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-sparkline

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-sparkline

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartSparkline } from "@/components/charts/area-chart-sparkline"
<AreaChartSparkline />
Web

Web preview

uniwind/components/charts/area-chart-sparkline.tsx
swift/Charts/AreaChartSparkline.swift
kotlin/charts/AreaChartSparkline.kt

Each row shows a symbol and company name, a tiny area chart without axes, the price and a colored badge with the percentage change. The sparkline turns green when the change is positive and red when it is negative, using the up and down colors in chartConfig. The charts are hidden from screen readers because the row text already carries the values. Each sparkline sets isAnimationActive={false} and draws without the enter animation.

Replace the stocks array with your own symbols, prices and changes, and swap the generated series data for real price history. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-sparkline

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-sparkline
$ pnpm dlx shadcn@latest add @esuiss/area-chart-sparkline

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-sparkline --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-sparkline

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-sparkline --platform kotlin

The CLI also adds what it builds on: Card, Chart, Text.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartSparkline } from "@/components/charts/area-chart-sparkline"
<AreaChartSparkline />
import SwiftUI

struct AreaSparklineExample: View {
  var body: some View {
    AreaChartSparkline()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartSparkline

@Composable
fun AreaSparklineExample() {
    AreaChartSparkline()
}

Stacked Expand

Two stacked areas normalized so every month fills 100%, showing each series' share rather than its value.

components/charts/area-chart-stacked-expand.tsx
"use client"

import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,

Two stacked areas stretched so every month fills the full height, turning absolute numbers into shares. Pick it over the regular stacked chart when the split between series matters more than the total.

Replace chartData and rename the series keys in the data, the areas and chartConfig. Every series needs the same stackId to be normalized together. The tooltip shows the original values, not percentages; add a tooltip formatter if readers need the share. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked-expand

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked-expand

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartStackedExpand } from "@/components/charts/area-chart-stacked-expand"
<AreaChartStackedExpand />
Web

Web preview

uniwind/components/charts/area-chart-stacked-expand.tsx
swift/Charts/AreaChartStackedExpand.swift
kotlin/charts/AreaChartStackedExpand.kt

Desktop and mobile areas share one stack with stackOffset="expand", so the chart shows the proportion of each series rather than raw totals. A value axis on the right reads 0%, 50% and 100%, and the tooltip lists both series.

Replace chartData with your records and change each dataKey to match your fields. Rename the series or change their colors in chartConfig. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked-expand

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked-expand
$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked-expand

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked-expand --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked-expand

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked-expand --platform kotlin

The CLI also adds what it builds on: Card, Chart.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartStackedExpand } from "@/components/charts/area-chart-stacked-expand"
<AreaChartStackedExpand />
import SwiftUI

struct AreaStackedExpandExample: View {
  var body: some View {
    AreaChartStackedExpand()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartStackedExpand

@Composable
fun AreaStackedExpandExample() {
    AreaChartStackedExpand()
}

Stacked

Two areas stacked on top of each other so the top edge shows the combined total, with a legend.

components/charts/area-chart-stacked.tsx
"use client"

import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartLegend,
  ChartLegendContent,

Two series stacked so the top edge shows the combined total, with a legend underneath. Use it when both the total and each part's contribution matter, as in desktop plus mobile traffic.

Replace chartData and rename the series keys in the data, both areas and chartConfig; the legend reads labels and colors from the config. Give every series the same stackId; the first one declared sits at the bottom. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartStacked } from "@/components/charts/area-chart-stacked"
<AreaChartStacked />
Web

Web preview

uniwind/components/charts/area-chart-stacked.tsx
swift/Charts/AreaChartStacked.swift
kotlin/charts/AreaChartStacked.kt

Desktop and mobile areas are stacked on top of each other with the same stackId, so the top edge shows the combined total. A legend below the plot names both series, and the tooltip lists each value with a dot indicator.

Replace chartData with your records and change each dataKey to match your fields. Add, rename or recolor series in chartConfig; the legend picks the changes up. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked
$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-stacked

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-stacked --platform kotlin

The CLI also adds what it builds on: Card, Chart.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartStacked } from "@/components/charts/area-chart-stacked"
<AreaChartStacked />
import SwiftUI

struct AreaStackedExample: View {
  var body: some View {
    AreaChartStacked()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartStacked

@Composable
fun AreaStackedExample() {
    AreaChartStacked()
}

Step

A single filled area drawn as steps, holding each value flat until the next reading.

components/charts/area-chart-step.tsx
"use client"

import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,

A single filled area drawn as steps that hold each value flat until the next reading. It suits values that change in discrete jumps, like prices, plan tiers or inventory counts.

Replace chartData, point each dataKey at your fields and set the label and color in chartConfig. Set the curve type to stepAfter or stepBefore to move the jump to the other side of each point. Focus the chart and use the arrow keys to move the tooltip between months.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-step

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-step

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartStep } from "@/components/charts/area-chart-step"
<AreaChartStep />
Web

Web preview

uniwind/components/charts/area-chart-step.tsx
swift/Charts/AreaChartStep.swift
kotlin/charts/AreaChartStep.kt

One series with type="step", which draws flat runs between readings instead of a slope. Use it for values that change at discrete moments, such as prices or plan limits. It has a month axis, a dashed grid and a tooltip.

Replace chartData with your records and change each dataKey to match your fields. Set the label and color in chartConfig. The component takes no props.

Installation

$ pnpm dlx shadcn@latest add @esuiss/area-chart-step

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-step
$ pnpm dlx shadcn@latest add @esuiss/area-chart-step

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-step --platform swift
$ pnpm dlx shadcn@latest add @esuiss/area-chart-step

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts area-chart-step --platform kotlin

The CLI also adds what it builds on: Card, Chart.

Follow the manual steps under Default and copy this variant's source instead.

Usage

import { AreaChartStep } from "@/components/charts/area-chart-step"
<AreaChartStep />
import SwiftUI

struct AreaStepExample: View {
  var body: some View {
    AreaChartStep()
  }
}
import androidx.compose.runtime.Composable
import com.esuiss.ui.charts.AreaChartStep

@Composable
fun AreaStepExample() {
    AreaChartStep()
}
NextBar ChartPreviousCharts

On this page

  1. 01Default
  2. 02Axes
  3. 03Gradient
  4. 04Interactive
  5. 05Linear
  6. 06Range
  7. 07Sparkline
  8. 08Stacked Expand
  9. 09Stacked
  10. 10Step