> ## Documentation Index
> Fetch the complete documentation index at: https://prefab.prefect.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AreaChart

> Visualize volume and trends with filled regions.

export const ComponentPreview = ({json, height, resizable, bare, hideJson, playground, children}) => {
  const hostRef = React.useRef(null);
  const handleRef = React.useRef(null);
  const cardRef = React.useRef(null);
  const containerRef = React.useRef(null);
  const [previewWidth, setPreviewWidth] = React.useState(null);
  const [isDragging, setIsDragging] = React.useState(false);
  const [playgroundHref, setPlaygroundHref] = React.useState(null);
  React.useEffect(function () {
    if (!playground) return;
    var isLocal = location.hostname === "localhost" || location.hostname === "127.0.0.1";
    var path = isLocal ? "/playground" : "/docs/playground";
    var url = new URL(path, window.location.href);
    url.hash = "code=" + playground;
    setPlaygroundHref(url.href);
  }, [playground]);
  var jsonStr = typeof json === "string" ? json : JSON.stringify(json, null, 2);
  React.useEffect(function () {
    if (cardRef.current) {
      var card = cardRef.current.closest(".group");
      if (card) card.classList.remove("group");
    }
    var host = hostRef.current;
    if (!host || !json) return;
    function mount() {
      if (!window.__prefab || !host) return;
      var dark = document.documentElement.classList.contains("dark");
      handleRef.current = window.__prefab.mountPreview(host, jsonStr, {
        dark: dark
      });
      if (bare && host.shadowRoot) {
        var m = host.shadowRoot.querySelector("[data-prefab-mount]");
        if (m) m.style.background = "transparent";
      }
    }
    if (window.__prefab) {
      mount();
    } else {
      if (!window.__prefabLoading) {
        if (!window.__prefabReady) {
          var s = document.createElement("script");
          s.src = "/renderer.js";
          document.head.appendChild(s);
        }
        window.__prefabLoading = new Promise(function (resolve) {
          function check() {
            if (window.__prefabReady) {
              window.__prefabReady.then(resolve);
            } else {
              setTimeout(check, 10);
            }
          }
          check();
        });
      }
      window.__prefabLoading.then(mount);
    }
    var observer = new MutationObserver(function () {
      var dark = document.documentElement.classList.contains("dark");
      if (handleRef.current) handleRef.current.setDark(dark);
    });
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class"]
    });
    return function () {
      observer.disconnect();
      if (handleRef.current) {
        handleRef.current.unmount();
        handleRef.current = null;
      }
    };
  }, [json]);
  function startResize(e) {
    e.preventDefault();
    var startX = e.clientX;
    var startW = hostRef.current ? hostRef.current.offsetWidth : 0;
    var maxW = containerRef.current ? containerRef.current.offsetWidth - 10 : startW;
    setIsDragging(true);
    function onMove(ev) {
      var w = Math.max(260, Math.min(startW + (ev.clientX - startX), maxW));
      setPreviewWidth(w);
    }
    function onUp() {
      document.removeEventListener("mousemove", onMove);
      document.removeEventListener("mouseup", onUp);
      setIsDragging(false);
    }
    document.addEventListener("mousemove", onMove);
    document.addEventListener("mouseup", onUp);
  }
  if (bare) {
    return <div ref={hostRef} />;
  }
  if (resizable) {
    return <Card>
        <div ref={cardRef} />
        <div ref={containerRef} style={{
      display: "flex",
      position: "relative",
      overflow: "hidden"
    }}>
          <div ref={hostRef} style={{
      flex: previewWidth ? "none" : 1,
      width: previewWidth ? previewWidth + "px" : undefined,
      minWidth: 0
    }} />
          <div onMouseDown={startResize} style={{
      width: "14px",
      flexShrink: 0,
      cursor: "col-resize",
      background: isDragging ? "var(--border, #e5e7eb)" : "color-mix(in srgb, var(--border, #e5e7eb) 40%, transparent)",
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      transition: "background 0.15s",
      userSelect: "none"
    }}>
            <svg width="6" height="24" style={{
      opacity: 0.5
    }}>
              <circle cx="2" cy="4" r="1.2" fill="currentColor" />
              <circle cx="2" cy="9" r="1.2" fill="currentColor" />
              <circle cx="2" cy="14" r="1.2" fill="currentColor" />
              <circle cx="2" cy="19" r="1.2" fill="currentColor" />
              <circle cx="5" cy="4" r="1.2" fill="currentColor" />
              <circle cx="5" cy="9" r="1.2" fill="currentColor" />
              <circle cx="5" cy="14" r="1.2" fill="currentColor" />
              <circle cx="5" cy="19" r="1.2" fill="currentColor" />
            </svg>
          </div>
          <div style={{
      flex: previewWidth ? 1 : "0 0 24px",
      minWidth: "24px",
      background: "repeating-linear-gradient(-45deg, transparent, transparent 3px, var(--border, #e5e7eb) 3px, var(--border, #e5e7eb) 4px)",
      opacity: 0.4
    }} />
          {previewWidth && <div style={{
      position: "absolute",
      bottom: "8px",
      right: "8px",
      background: "var(--background, white)",
      border: "1px solid var(--border, #e5e7eb)",
      borderRadius: "4px",
      padding: "1px 6px",
      fontSize: "11px",
      fontFamily: "monospace",
      color: "var(--muted-foreground, #6b7280)",
      pointerEvents: "none"
    }}>
              {previewWidth}px
            </div>}
        </div>
        {playgroundHref && <div style={{
      display: "flex",
      justifyContent: "flex-end",
      padding: "4px 0 8px"
    }}>
            <a href={playgroundHref} target="_blank" rel="noopener noreferrer" style={{
      fontSize: "11px",
      opacity: 0.4,
      textDecoration: "none",
      textDecorationLine: "none",
      borderBottom: "none",
      boxShadow: "none",
      display: "inline-flex",
      alignItems: "center",
      gap: "3px",
      transition: "opacity 0.15s",
      fontWeight: 400
    }} onMouseOver={function (e) {
      e.currentTarget.style.opacity = "0.6";
    }} onMouseOut={function (e) {
      e.currentTarget.style.opacity = "0.4";
    }}>
              Edit in Playground
              <svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M15 3h6v6" /><path d="M10 14 21 3" /><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /></svg>
            </a>
          </div>}
        <div style={{
      marginBottom: "-2rem"
    }}>{children}</div>
      </Card>;
  }
  return <Card>
      <div ref={cardRef} />
      <div ref={hostRef} />
      {playgroundHref && <div style={{
    display: "flex",
    justifyContent: "flex-end",
    padding: "4px 0 8px"
  }}>
          <a href={playgroundHref} target="_blank" rel="noopener noreferrer" style={{
    fontSize: "11px",
    opacity: 0.4,
    textDecoration: "none",
    textDecorationLine: "none",
    borderBottom: "none",
    boxShadow: "none",
    display: "inline-flex",
    alignItems: "center",
    gap: "3px",
    transition: "opacity 0.15s",
    fontWeight: 400
  }} onMouseOver={function (e) {
    e.currentTarget.style.opacity = "0.6";
  }} onMouseOut={function (e) {
    e.currentTarget.style.opacity = "0.4";
  }}>
            Edit in Playground
            <svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M15 3h6v6" /><path d="M10 14 21 3" /><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /></svg>
          </a>
        </div>}
      <div style={{
    marginBottom: "-2rem"
  }}>{children}</div>
    </Card>;
};

AreaChart fills the region between a line and the axis, emphasizing the magnitude of values over time. It supports stacking, which makes it easy to show how parts contribute to a whole. See [Charts](/components/charts) for the shared data, series, and formatting model.

## Basic Usage

<ComponentPreview json={{"view":{"type":"AreaChart","data":[{"month":"Jan","desktop":186,"mobile":80},{"month":"Feb","desktop":305,"mobile":200},{"month":"Mar","desktop":237,"mobile":120},{"month":"Apr","desktop":73,"mobile":190},{"month":"May","desktop":209,"mobile":130},{"month":"Jun","desktop":214,"mobile":140}],"series":[{"dataKey":"desktop","label":"Desktop"},{"dataKey":"mobile","label":"Mobile"}],"xAxis":"month","height":300,"stacked":false,"curve":"linear","showDots":false,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"auto"}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cy5jaGFydHMgaW1wb3J0IEFyZWFDaGFydCwgQ2hhcnRTZXJpZXMKCmRhdGEgPSBbCiAgICB7Im1vbnRoIjogIkphbiIsICJkZXNrdG9wIjogMTg2LCAibW9iaWxlIjogODB9LAogICAgeyJtb250aCI6ICJGZWIiLCAiZGVza3RvcCI6IDMwNSwgIm1vYmlsZSI6IDIwMH0sCiAgICB7Im1vbnRoIjogIk1hciIsICJkZXNrdG9wIjogMjM3LCAibW9iaWxlIjogMTIwfSwKICAgIHsibW9udGgiOiAiQXByIiwgImRlc2t0b3AiOiA3MywgIm1vYmlsZSI6IDE5MH0sCiAgICB7Im1vbnRoIjogIk1heSIsICJkZXNrdG9wIjogMjA5LCAibW9iaWxlIjogMTMwfSwKICAgIHsibW9udGgiOiAiSnVuIiwgImRlc2t0b3AiOiAyMTQsICJtb2JpbGUiOiAxNDB9LApdCgpBcmVhQ2hhcnQoCiAgICBkYXRhPWRhdGEsCiAgICBzZXJpZXM9WwogICAgICAgIENoYXJ0U2VyaWVzKGRhdGFfa2V5PSJkZXNrdG9wIiwgbGFiZWw9IkRlc2t0b3AiKSwKICAgICAgICBDaGFydFNlcmllcyhkYXRhX2tleT0ibW9iaWxlIiwgbGFiZWw9Ik1vYmlsZSIpLAogICAgXSwKICAgIHhfYXhpcz0ibW9udGgiLAogICAgc2hvd19sZWdlbmQ9VHJ1ZSwKKQo">
  <CodeGroup>
    ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui.components.charts import AreaChart, ChartSeries

    data = [
        {"month": "Jan", "desktop": 186, "mobile": 80},
        {"month": "Feb", "desktop": 305, "mobile": 200},
        {"month": "Mar", "desktop": 237, "mobile": 120},
        {"month": "Apr", "desktop": 73, "mobile": 190},
        {"month": "May", "desktop": 209, "mobile": 130},
        {"month": "Jun", "desktop": 214, "mobile": 140},
    ]

    AreaChart(
        data=data,
        series=[
            ChartSeries(data_key="desktop", label="Desktop"),
            ChartSeries(data_key="mobile", label="Mobile"),
        ],
        x_axis="month",
        show_legend=True,
    )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "type": "AreaChart",
        "data": [
          {"month": "Jan", "desktop": 186, "mobile": 80},
          {"month": "Feb", "desktop": 305, "mobile": 200},
          {"month": "Mar", "desktop": 237, "mobile": 120},
          {"month": "Apr", "desktop": 73, "mobile": 190},
          {"month": "May", "desktop": 209, "mobile": 130},
          {"month": "Jun", "desktop": 214, "mobile": 140}
        ],
        "series": [
          {"dataKey": "desktop", "label": "Desktop"},
          {"dataKey": "mobile", "label": "Mobile"}
        ],
        "xAxis": "month",
        "height": 300,
        "stacked": false,
        "curve": "linear",
        "showDots": false,
        "showLegend": true,
        "showTooltip": true,
        "animate": true,
        "showGrid": true,
        "showYAxis": true,
        "valueFormat": "auto"
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Stacked

Stacking shows how each series contributes to the total. The topmost line represents the combined value.

<ComponentPreview json={{"view":{"type":"AreaChart","data":[{"month":"Jan","desktop":186,"mobile":80},{"month":"Feb","desktop":305,"mobile":200},{"month":"Mar","desktop":237,"mobile":120},{"month":"Apr","desktop":73,"mobile":190},{"month":"May","desktop":209,"mobile":130},{"month":"Jun","desktop":214,"mobile":140}],"series":[{"dataKey":"desktop","label":"Desktop"},{"dataKey":"mobile","label":"Mobile"}],"xAxis":"month","height":300,"stacked":true,"curve":"linear","showDots":false,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"auto"}}} playground="QXJlYUNoYXJ0KAogICAgZGF0YT1kYXRhLAogICAgc2VyaWVzPVsKICAgICAgICBDaGFydFNlcmllcyhkYXRhX2tleT0iZGVza3RvcCIsIGxhYmVsPSJEZXNrdG9wIiksCiAgICAgICAgQ2hhcnRTZXJpZXMoZGF0YV9rZXk9Im1vYmlsZSIsIGxhYmVsPSJNb2JpbGUiKSwKICAgIF0sCiAgICB4X2F4aXM9Im1vbnRoIiwKICAgIHN0YWNrZWQ9VHJ1ZSwKICAgIHNob3dfbGVnZW5kPVRydWUsCikK">
  <CodeGroup>
    ```python Python {8} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    AreaChart(
        data=data,
        series=[
            ChartSeries(data_key="desktop", label="Desktop"),
            ChartSeries(data_key="mobile", label="Mobile"),
        ],
        x_axis="month",
        stacked=True,
        show_legend=True,
    )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "type": "AreaChart",
        "data": [
          {"month": "Jan", "desktop": 186, "mobile": 80},
          {"month": "Feb", "desktop": 305, "mobile": 200},
          {"month": "Mar", "desktop": 237, "mobile": 120},
          {"month": "Apr", "desktop": 73, "mobile": 190},
          {"month": "May", "desktop": 209, "mobile": 130},
          {"month": "Jun", "desktop": 214, "mobile": 140}
        ],
        "series": [
          {"dataKey": "desktop", "label": "Desktop"},
          {"dataKey": "mobile", "label": "Mobile"}
        ],
        "xAxis": "month",
        "height": 300,
        "stacked": true,
        "curve": "linear",
        "showDots": false,
        "showLegend": true,
        "showTooltip": true,
        "animate": true,
        "showGrid": true,
        "showYAxis": true,
        "valueFormat": "auto"
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Minimal

Set `show_grid=False` to drop the background gridlines. Without them the filled area reads as a single glanceable shape — a good fit for compact trend cards where the silhouette matters more than reading exact values off an axis.

<ComponentPreview json={{"view":{"type":"AreaChart","data":[{"month":"Jan","desktop":186,"mobile":80},{"month":"Feb","desktop":305,"mobile":200},{"month":"Mar","desktop":237,"mobile":120},{"month":"Apr","desktop":73,"mobile":190},{"month":"May","desktop":209,"mobile":130},{"month":"Jun","desktop":214,"mobile":140}],"series":[{"dataKey":"desktop","label":"Desktop"}],"xAxis":"month","height":300,"stacked":false,"curve":"linear","showDots":false,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":false,"showYAxis":true,"valueFormat":"auto"}}} playground="QXJlYUNoYXJ0KAogICAgZGF0YT1kYXRhLAogICAgc2VyaWVzPVtDaGFydFNlcmllcyhkYXRhX2tleT0iZGVza3RvcCIsIGxhYmVsPSJEZXNrdG9wIildLAogICAgeF9heGlzPSJtb250aCIsCiAgICBzaG93X2dyaWQ9RmFsc2UsCikK">
  <CodeGroup>
    ```python Python {5} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    AreaChart(
        data=data,
        series=[ChartSeries(data_key="desktop", label="Desktop")],
        x_axis="month",
        show_grid=False,
    )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "type": "AreaChart",
        "data": [
          {"month": "Jan", "desktop": 186, "mobile": 80},
          {"month": "Feb", "desktop": 305, "mobile": 200},
          {"month": "Mar", "desktop": 237, "mobile": 120},
          {"month": "Apr", "desktop": 73, "mobile": 190},
          {"month": "May", "desktop": 209, "mobile": 130},
          {"month": "Jun", "desktop": 214, "mobile": 140}
        ],
        "series": [{"dataKey": "desktop", "label": "Desktop"}],
        "xAxis": "month",
        "height": 300,
        "stacked": false,
        "curve": "linear",
        "showDots": false,
        "showLegend": true,
        "showTooltip": true,
        "animate": true,
        "showGrid": false,
        "showYAxis": true,
        "valueFormat": "auto"
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Smooth

Set `curve="smooth"` for gently curved lines between data points. The filled area follows the curve.

<ComponentPreview json={{"view":{"type":"AreaChart","data":[{"month":"Jan","desktop":186,"mobile":80},{"month":"Feb","desktop":305,"mobile":200},{"month":"Mar","desktop":237,"mobile":120},{"month":"Apr","desktop":73,"mobile":190},{"month":"May","desktop":209,"mobile":130},{"month":"Jun","desktop":214,"mobile":140}],"series":[{"dataKey":"desktop","label":"Desktop"},{"dataKey":"mobile","label":"Mobile"}],"xAxis":"month","height":300,"stacked":false,"curve":"smooth","showDots":false,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"auto"}}} playground="QXJlYUNoYXJ0KAogICAgZGF0YT1kYXRhLAogICAgc2VyaWVzPVsKICAgICAgICBDaGFydFNlcmllcyhkYXRhX2tleT0iZGVza3RvcCIsIGxhYmVsPSJEZXNrdG9wIiksCiAgICAgICAgQ2hhcnRTZXJpZXMoZGF0YV9rZXk9Im1vYmlsZSIsIGxhYmVsPSJNb2JpbGUiKSwKICAgIF0sCiAgICB4X2F4aXM9Im1vbnRoIiwKICAgIGN1cnZlPSJzbW9vdGgiLAogICAgc2hvd19sZWdlbmQ9VHJ1ZSwKKQo">
  <CodeGroup>
    ```python Python {8} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    AreaChart(
        data=data,
        series=[
            ChartSeries(data_key="desktop", label="Desktop"),
            ChartSeries(data_key="mobile", label="Mobile"),
        ],
        x_axis="month",
        curve="smooth",
        show_legend=True,
    )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "type": "AreaChart",
        "data": [
          {"month": "Jan", "desktop": 186, "mobile": 80},
          {"month": "Feb", "desktop": 305, "mobile": 200},
          {"month": "Mar", "desktop": 237, "mobile": 120},
          {"month": "Apr", "desktop": 73, "mobile": 190},
          {"month": "May", "desktop": 209, "mobile": 130},
          {"month": "Jun", "desktop": 214, "mobile": 140}
        ],
        "series": [
          {"dataKey": "desktop", "label": "Desktop"},
          {"dataKey": "mobile", "label": "Mobile"}
        ],
        "xAxis": "month",
        "height": 300,
        "stacked": false,
        "curve": "smooth",
        "showDots": false,
        "showLegend": true,
        "showTooltip": true,
        "animate": true,
        "showGrid": true,
        "showYAxis": true,
        "valueFormat": "auto"
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Step

Set `curve="step"` to connect points with step-shaped lines. The filled area follows the stepped edges.

<ComponentPreview json={{"view":{"type":"AreaChart","data":[{"month":"Jan","desktop":186,"mobile":80},{"month":"Feb","desktop":305,"mobile":200},{"month":"Mar","desktop":237,"mobile":120},{"month":"Apr","desktop":73,"mobile":190},{"month":"May","desktop":209,"mobile":130},{"month":"Jun","desktop":214,"mobile":140}],"series":[{"dataKey":"desktop","label":"Desktop"},{"dataKey":"mobile","label":"Mobile"}],"xAxis":"month","height":300,"stacked":false,"curve":"step","showDots":false,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"auto"}}} playground="QXJlYUNoYXJ0KAogICAgZGF0YT1kYXRhLAogICAgc2VyaWVzPVsKICAgICAgICBDaGFydFNlcmllcyhkYXRhX2tleT0iZGVza3RvcCIsIGxhYmVsPSJEZXNrdG9wIiksCiAgICAgICAgQ2hhcnRTZXJpZXMoZGF0YV9rZXk9Im1vYmlsZSIsIGxhYmVsPSJNb2JpbGUiKSwKICAgIF0sCiAgICB4X2F4aXM9Im1vbnRoIiwKICAgIGN1cnZlPSJzdGVwIiwKICAgIHNob3dfbGVnZW5kPVRydWUsCikK">
  <CodeGroup>
    ```python Python {8} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    AreaChart(
        data=data,
        series=[
            ChartSeries(data_key="desktop", label="Desktop"),
            ChartSeries(data_key="mobile", label="Mobile"),
        ],
        x_axis="month",
        curve="step",
        show_legend=True,
    )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "type": "AreaChart",
        "data": [
          {"month": "Jan", "desktop": 186, "mobile": 80},
          {"month": "Feb", "desktop": 305, "mobile": 200},
          {"month": "Mar", "desktop": 237, "mobile": 120},
          {"month": "Apr", "desktop": 73, "mobile": 190},
          {"month": "May", "desktop": 209, "mobile": 130},
          {"month": "Jun", "desktop": 214, "mobile": 140}
        ],
        "series": [
          {"dataKey": "desktop", "label": "Desktop"},
          {"dataKey": "mobile", "label": "Mobile"}
        ],
        "xAxis": "month",
        "height": 300,
        "stacked": false,
        "curve": "step",
        "showDots": false,
        "showLegend": true,
        "showTooltip": true,
        "animate": true,
        "showGrid": true,
        "showYAxis": true,
        "valueFormat": "auto"
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Value Formatting

Use `value_format` to format numeric values on the value axis and in tooltips. It accepts the same pipe strings as Prefab expressions and data table columns, including `currency`, `currency:EUR`, `percent:1`, and `compact:0`.

<ComponentPreview json={{"view":{"type":"AreaChart","data":[{"month":"Jan","hosting":34000,"storage":12000},{"month":"Feb","hosting":41000,"storage":13500},{"month":"Mar","hosting":46000,"storage":15000},{"month":"Apr","hosting":52000,"storage":16500}],"series":[{"dataKey":"hosting","label":"Hosting"},{"dataKey":"storage","label":"Storage"}],"xAxis":"month","height":300,"stacked":true,"curve":"linear","showDots":false,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"currency"}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cy5jaGFydHMgaW1wb3J0IEFyZWFDaGFydCwgQ2hhcnRTZXJpZXMKCmRhdGEgPSBbCiAgICB7Im1vbnRoIjogIkphbiIsICJob3N0aW5nIjogMzRfMDAwLCAic3RvcmFnZSI6IDEyXzAwMH0sCiAgICB7Im1vbnRoIjogIkZlYiIsICJob3N0aW5nIjogNDFfMDAwLCAic3RvcmFnZSI6IDEzXzUwMH0sCiAgICB7Im1vbnRoIjogIk1hciIsICJob3N0aW5nIjogNDZfMDAwLCAic3RvcmFnZSI6IDE1XzAwMH0sCiAgICB7Im1vbnRoIjogIkFwciIsICJob3N0aW5nIjogNTJfMDAwLCAic3RvcmFnZSI6IDE2XzUwMH0sCl0KCkFyZWFDaGFydCgKICAgIGRhdGE9ZGF0YSwKICAgIHNlcmllcz1bCiAgICAgICAgQ2hhcnRTZXJpZXMoZGF0YV9rZXk9Imhvc3RpbmciLCBsYWJlbD0iSG9zdGluZyIpLAogICAgICAgIENoYXJ0U2VyaWVzKGRhdGFfa2V5PSJzdG9yYWdlIiwgbGFiZWw9IlN0b3JhZ2UiKSwKICAgIF0sCiAgICB4X2F4aXM9Im1vbnRoIiwKICAgIHN0YWNrZWQ9VHJ1ZSwKICAgIHZhbHVlX2Zvcm1hdD0iY3VycmVuY3kiLAogICAgc2hvd19sZWdlbmQ9VHJ1ZSwKKQo">
  <CodeGroup>
    ```python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui.components.charts import AreaChart, ChartSeries

    data = [
        {"month": "Jan", "hosting": 34_000, "storage": 12_000},
        {"month": "Feb", "hosting": 41_000, "storage": 13_500},
        {"month": "Mar", "hosting": 46_000, "storage": 15_000},
        {"month": "Apr", "hosting": 52_000, "storage": 16_500},
    ]

    AreaChart(
        data=data,
        series=[
            ChartSeries(data_key="hosting", label="Hosting"),
            ChartSeries(data_key="storage", label="Storage"),
        ],
        x_axis="month",
        stacked=True,
        value_format="currency",
        show_legend=True,
    )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "type": "AreaChart",
        "data": [
          {"month": "Jan", "hosting": 34000, "storage": 12000},
          {"month": "Feb", "hosting": 41000, "storage": 13500},
          {"month": "Mar", "hosting": 46000, "storage": 15000},
          {"month": "Apr", "hosting": 52000, "storage": 16500}
        ],
        "series": [
          {"dataKey": "hosting", "label": "Hosting"},
          {"dataKey": "storage", "label": "Storage"}
        ],
        "xAxis": "month",
        "height": 300,
        "stacked": true,
        "curve": "linear",
        "showDots": false,
        "showLegend": true,
        "showTooltip": true,
        "animate": true,
        "showGrid": true,
        "showYAxis": true,
        "valueFormat": "currency"
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## API Reference

<Card icon="code" title="AreaChart Parameters">
  <ParamField body="data" type="list[dict] | str" required>
    Data as a list of dicts, or a `{{ field }}` interpolation reference.
  </ParamField>

  <ParamField body="series" type="list[ChartSeries]" required>
    Series definitions — each becomes a filled area on the chart.
  </ParamField>

  <ParamField body="x_axis" type="str | None" default="None">
    Data key for x-axis labels.
  </ParamField>

  <ParamField body="height" type="int" default="300">
    Chart height in pixels.
  </ParamField>

  <ParamField body="stacked" type="bool" default="False">
    Stack areas on top of each other.
  </ParamField>

  <ParamField body="curve" type="Literal[&#x22;linear&#x22;, &#x22;smooth&#x22;, &#x22;step&#x22;]" default="&#x22;linear&#x22;">
    Interpolation curve between data points.
  </ParamField>

  <ParamField body="show_dots" type="bool" default="False">
    Show a dot at each data point.
  </ParamField>

  <ParamField body="show_legend" type="bool" default="False">
    Show a legend below the chart.
  </ParamField>

  <ParamField body="show_tooltip" type="bool" default="True">
    Show tooltips on hover.
  </ParamField>

  <ParamField body="show_grid" type="bool" default="True">
    Show horizontal grid lines.
  </ParamField>

  <ParamField body="show_y_axis" type="bool" default="True">
    Show the y-axis with its tick labels. Set to `False` for a compact, axis-free reading where the shape matters more than exact values.
  </ParamField>

  <ParamField body="value_format" type="str" default="&#x22;auto&#x22;">
    Format value-axis ticks and tooltip values with an expression pipe such as `currency`, `currency:EUR`, `percent:1`, or `compact:0`.
  </ParamField>

  <ParamField body="css_class" type="str | None" default="None">
    Additional Tailwind CSS classes.
  </ParamField>
</Card>

<Card icon="code" title="ChartSeries Parameters">
  <ParamField body="data_key" type="str" required>
    Data field to plot — must match a key in the data dicts.
  </ParamField>

  <ParamField body="label" type="str | None" default="None">
    Display label for legends and tooltips. Defaults to the `data_key` value.
  </ParamField>

  <ParamField body="color" type="str | None" default="None">
    CSS color override. By default, colors cycle through the theme's chart palette (`--chart-1` through `--chart-5`).
  </ParamField>
</Card>

## Protocol Reference

```json AreaChart theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "AreaChart",
  "id?": "string",
  "onMount?": "any",
  "data": "object[] | string (required)",
  "series": "[ChartSeries] (required)",
  "xAxis?": "string",
  "height?": "300",
  "stacked?": false,
  "curve?": "linear | smooth | step",
  "showDots?": false,
  "showLegend?": true,
  "showTooltip?": true,
  "animate?": true,
  "showGrid?": true,
  "showYAxis?": true,
  "valueFormat?": "string",
  "cssClass?": "string"
}
```

```json ChartSeries theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "dataKey": "string (required)",
  "label?": "string",
  "color?": "string"
}
```

For the complete protocol schema, see [AreaChart](/protocol/area-chart), [ChartSeries](/protocol/chart-series).
