> ## 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.

# Dashboard

> Explicit grid placement for dashboard-style layouts with positioned items.

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>;
};

Prefab has two grid components, and the choice between them comes down to whether you need explicit positioning:

* [**Grid**](/docs/components/grid) auto-flows children left-to-right, wrapping to new rows. Wrap children in [GridItem](/docs/components/grid#spanning-cells) to span multiple columns or rows while keeping responsive reflow. Use Grid for most layouts, including dashboard-style layouts where items have different sizes but don't need pinned coordinates.

* **Dashboard** places items at exact grid coordinates. Each child is a DashboardItem with explicit `col`, `row`, `col_span`, and `row_span` values. Use Dashboard when you need pixel-precise control over where every item sits, like a drag-and-drop layout builder.

Dashboard works like pinning widgets to a canvas. You define the grid with a `columns` count and a `row_height`, then wrap each piece of content in a DashboardItem that declares its position (`col`, `row`) and size (`col_span`, `row_span`). Coordinates are 1-indexed, matching CSS Grid conventions.

## Basic Usage

A Dashboard needs a `columns` count and a `row_height` (in pixels by default). Each child DashboardItem declares where it sits on the grid. Here, a 4-column grid places four blocks: A spans 2 columns across the top-left, B fills the top-right, C occupies a single cell on the second row, and D stretches across the remaining 3 columns.

<ComponentPreview json={{"view":{"cssClass":"gap-4","type":"Dashboard","columns":4,"rowHeight":80,"children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":2,"rowSpan":1,"children":[{"cssClass":"bg-blue-500 rounded-md h-full flex items-center justify-center","type":"Div","children":[{"cssClass":"text-white font-semibold","content":"A","type":"Text"}]}]},{"type":"DashboardItem","col":3,"row":1,"colSpan":2,"rowSpan":1,"children":[{"cssClass":"bg-emerald-500 rounded-md h-full flex items-center justify-center","type":"Div","children":[{"cssClass":"text-white font-semibold","content":"B","type":"Text"}]}]},{"type":"DashboardItem","col":1,"row":2,"colSpan":1,"rowSpan":1,"children":[{"cssClass":"bg-amber-500 rounded-md h-full flex items-center justify-center","type":"Div","children":[{"cssClass":"text-white font-semibold","content":"C","type":"Text"}]}]},{"type":"DashboardItem","col":2,"row":2,"colSpan":3,"rowSpan":1,"children":[{"cssClass":"bg-purple-500 rounded-md h-full flex items-center justify-center","type":"Div","children":[{"cssClass":"text-white font-semibold","content":"D","type":"Text"}]}]}]}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cyBpbXBvcnQgRGFzaGJvYXJkLCBEYXNoYm9hcmRJdGVtLCBEaXYsIFRleHQKCndpdGggRGFzaGJvYXJkKGNvbHVtbnM9NCwgcm93X2hlaWdodD04MCwgZ2FwPTQpOgogICAgIyBBOiBzdGFydHMgYXQgY29sdW1uIDEsIHJvdyAxLCBzcGFucyAyIGNvbHVtbnMKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MSwgcm93PTEsIGNvbF9zcGFuPTIpOgogICAgICAgIHdpdGggRGl2KGNzc19jbGFzcz0iYmctYmx1ZS01MDAgcm91bmRlZC1tZCBoLWZ1bGwgZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXIiKToKICAgICAgICAgICAgVGV4dCgiQSIsIGNzc19jbGFzcz0idGV4dC13aGl0ZSBmb250LXNlbWlib2xkIikKICAgICMgQjogc3RhcnRzIGF0IGNvbHVtbiAzLCByb3cgMSwgc3BhbnMgMiBjb2x1bW5zCiAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTMsIHJvdz0xLCBjb2xfc3Bhbj0yKToKICAgICAgICB3aXRoIERpdihjc3NfY2xhc3M9ImJnLWVtZXJhbGQtNTAwIHJvdW5kZWQtbWQgaC1mdWxsIGZsZXggaXRlbXMtY2VudGVyIGp1c3RpZnktY2VudGVyIik6CiAgICAgICAgICAgIFRleHQoIkIiLCBjc3NfY2xhc3M9InRleHQtd2hpdGUgZm9udC1zZW1pYm9sZCIpCiAgICAjIEM6IHNpbmdsZSBjZWxsIGF0IGNvbHVtbiAxLCByb3cgMgogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0xLCByb3c9Mik6CiAgICAgICAgd2l0aCBEaXYoY3NzX2NsYXNzPSJiZy1hbWJlci01MDAgcm91bmRlZC1tZCBoLWZ1bGwgZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXIiKToKICAgICAgICAgICAgVGV4dCgiQyIsIGNzc19jbGFzcz0idGV4dC13aGl0ZSBmb250LXNlbWlib2xkIikKICAgICMgRDogc3RhcnRzIGF0IGNvbHVtbiAyLCByb3cgMiwgc3BhbnMgdGhlIHJlbWFpbmluZyAzIGNvbHVtbnMKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9Miwgcm93PTIsIGNvbF9zcGFuPTMpOgogICAgICAgIHdpdGggRGl2KGNzc19jbGFzcz0iYmctcHVycGxlLTUwMCByb3VuZGVkLW1kIGgtZnVsbCBmbGV4IGl0ZW1zLWNlbnRlciBqdXN0aWZ5LWNlbnRlciIpOgogICAgICAgICAgICBUZXh0KCJEIiwgY3NzX2NsYXNzPSJ0ZXh0LXdoaXRlIGZvbnQtc2VtaWJvbGQiKQo">
  <CodeGroup>
    ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui.components import Dashboard, DashboardItem, Div, Text

    with Dashboard(columns=4, row_height=80, gap=4):
        # A: starts at column 1, row 1, spans 2 columns
        with DashboardItem(col=1, row=1, col_span=2):
            with Div(css_class="bg-blue-500 rounded-md h-full flex items-center justify-center"):
                Text("A", css_class="text-white font-semibold")
        # B: starts at column 3, row 1, spans 2 columns
        with DashboardItem(col=3, row=1, col_span=2):
            with Div(css_class="bg-emerald-500 rounded-md h-full flex items-center justify-center"):
                Text("B", css_class="text-white font-semibold")
        # C: single cell at column 1, row 2
        with DashboardItem(col=1, row=2):
            with Div(css_class="bg-amber-500 rounded-md h-full flex items-center justify-center"):
                Text("C", css_class="text-white font-semibold")
        # D: starts at column 2, row 2, spans the remaining 3 columns
        with DashboardItem(col=2, row=2, col_span=3):
            with Div(css_class="bg-purple-500 rounded-md h-full flex items-center justify-center"):
                Text("D", css_class="text-white font-semibold")
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "cssClass": "gap-4",
        "type": "Dashboard",
        "columns": 4,
        "rowHeight": 80,
        "children": [
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 1,
            "colSpan": 2,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "bg-blue-500 rounded-md h-full flex items-center justify-center",
                "type": "Div",
                "children": [{"cssClass": "text-white font-semibold", "content": "A", "type": "Text"}]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 3,
            "row": 1,
            "colSpan": 2,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "bg-emerald-500 rounded-md h-full flex items-center justify-center",
                "type": "Div",
                "children": [{"cssClass": "text-white font-semibold", "content": "B", "type": "Text"}]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 2,
            "colSpan": 1,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "bg-amber-500 rounded-md h-full flex items-center justify-center",
                "type": "Div",
                "children": [{"cssClass": "text-white font-semibold", "content": "C", "type": "Text"}]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 2,
            "row": 2,
            "colSpan": 3,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "bg-purple-500 rounded-md h-full flex items-center justify-center",
                "type": "Div",
                "children": [{"cssClass": "text-white font-semibold", "content": "D", "type": "Text"}]
              }
            ]
          }
        ]
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Dashboard Layout

A common dashboard pattern uses a 12-column grid (like Bootstrap's grid system) to mix wide and narrow elements. The trick is planning your rows: the chart card starts at column 1 and spans 8 of the 12 columns, while three stat cards stack in the remaining 4 columns (columns 9-12). Each stat card takes one row; the chart spans all three rows so it lines up with them. A full-width table sits below in row 4.

To make children fill their grid cells, use `css_class="h-full"` on the content inside each DashboardItem.

<ComponentPreview json={{"view":{"cssClass":"gap-4","type":"Dashboard","columns":12,"rowHeight":100,"children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":8,"rowSpan":3,"children":[{"cssClass":"h-full","type":"Card","children":[{"type":"CardHeader","children":[{"type":"CardTitle","content":"Revenue Over Time"}]},{"type":"CardContent","children":[{"cssClass":"h-full bg-gradient-to-r from-blue-100 to-blue-50 rounded-md","type":"Div"}]}]}]},{"type":"DashboardItem","col":9,"row":1,"colSpan":4,"rowSpan":1,"children":[{"cssClass":"h-full","type":"Card","children":[{"cssClass":"pb-2","type":"CardHeader","children":[{"content":"Total Revenue","type":"Muted"}]},{"type":"CardContent","children":[{"content":"$45,231","type":"H2"}]}]}]},{"type":"DashboardItem","col":9,"row":2,"colSpan":4,"rowSpan":1,"children":[{"cssClass":"h-full","type":"Card","children":[{"cssClass":"pb-2","type":"CardHeader","children":[{"content":"Active Users","type":"Muted"}]},{"type":"CardContent","children":[{"content":"2,350","type":"H2"}]}]}]},{"type":"DashboardItem","col":9,"row":3,"colSpan":4,"rowSpan":1,"children":[{"cssClass":"h-full","type":"Card","children":[{"cssClass":"pb-2","type":"CardHeader","children":[{"content":"Conversion Rate","type":"Muted"}]},{"type":"CardContent","children":[{"content":"3.2%","type":"H2"}]}]}]},{"type":"DashboardItem","col":1,"row":4,"colSpan":12,"rowSpan":2,"children":[{"cssClass":"h-full","type":"Card","children":[{"type":"CardHeader","children":[{"type":"CardTitle","content":"Recent Transactions"}]},{"type":"CardContent","children":[{"cssClass":"h-full bg-gradient-to-r from-gray-100 to-gray-50 rounded-md","type":"Div"}]}]}]}]}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cyBpbXBvcnQgKAogICAgQ2FyZCwgQ2FyZENvbnRlbnQsIENhcmRIZWFkZXIsIENhcmRUaXRsZSwKICAgIERhc2hib2FyZCwgRGFzaGJvYXJkSXRlbSwKICAgIERpdiwgSDIsIE11dGVkLAopCgp3aXRoIERhc2hib2FyZChjb2x1bW5zPTEyLCByb3dfaGVpZ2h0PTEwMCwgZ2FwPTQpOgogICAgIyBDaGFydDogY29sdW1ucyAxLTgsIHJvd3MgMS0zIChzcGFucyBhbGwgdGhyZWUgc3RhdCBjYXJkIHJvd3MpCiAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTEsIHJvdz0xLCBjb2xfc3Bhbj04LCByb3dfc3Bhbj0zKToKICAgICAgICB3aXRoIENhcmQoY3NzX2NsYXNzPSJoLWZ1bGwiKToKICAgICAgICAgICAgd2l0aCBDYXJkSGVhZGVyKCk6CiAgICAgICAgICAgICAgICBDYXJkVGl0bGUoIlJldmVudWUgT3ZlciBUaW1lIikKICAgICAgICAgICAgd2l0aCBDYXJkQ29udGVudCgpOgogICAgICAgICAgICAgICAgRGl2KGNzc19jbGFzcz0iaC1mdWxsIGJnLWdyYWRpZW50LXRvLXIgZnJvbS1ibHVlLTEwMCB0by1ibHVlLTUwIHJvdW5kZWQtbWQiKQoKICAgICMgU3RhdCBjYXJkczogY29sdW1uIDktMTIsIG9uZSBwZXIgcm93CiAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTksIHJvdz0xLCBjb2xfc3Bhbj00KToKICAgICAgICB3aXRoIENhcmQoY3NzX2NsYXNzPSJoLWZ1bGwiKToKICAgICAgICAgICAgd2l0aCBDYXJkSGVhZGVyKGNzc19jbGFzcz0icGItMiIpOgogICAgICAgICAgICAgICAgTXV0ZWQoIlRvdGFsIFJldmVudWUiKQogICAgICAgICAgICB3aXRoIENhcmRDb250ZW50KCk6CiAgICAgICAgICAgICAgICBIMigiJDQ1LDIzMSIpCgogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD05LCByb3c9MiwgY29sX3NwYW49NCk6CiAgICAgICAgd2l0aCBDYXJkKGNzc19jbGFzcz0iaC1mdWxsIik6CiAgICAgICAgICAgIHdpdGggQ2FyZEhlYWRlcihjc3NfY2xhc3M9InBiLTIiKToKICAgICAgICAgICAgICAgIE11dGVkKCJBY3RpdmUgVXNlcnMiKQogICAgICAgICAgICB3aXRoIENhcmRDb250ZW50KCk6CiAgICAgICAgICAgICAgICBIMigiMiwzNTAiKQoKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9OSwgcm93PTMsIGNvbF9zcGFuPTQpOgogICAgICAgIHdpdGggQ2FyZChjc3NfY2xhc3M9ImgtZnVsbCIpOgogICAgICAgICAgICB3aXRoIENhcmRIZWFkZXIoY3NzX2NsYXNzPSJwYi0yIik6CiAgICAgICAgICAgICAgICBNdXRlZCgiQ29udmVyc2lvbiBSYXRlIikKICAgICAgICAgICAgd2l0aCBDYXJkQ29udGVudCgpOgogICAgICAgICAgICAgICAgSDIoIjMuMiUiKQoKICAgICMgRnVsbC13aWR0aCB0YWJsZTogYWxsIDEyIGNvbHVtbnMsIHJvd3MgNC01CiAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTEsIHJvdz00LCBjb2xfc3Bhbj0xMiwgcm93X3NwYW49Mik6CiAgICAgICAgd2l0aCBDYXJkKGNzc19jbGFzcz0iaC1mdWxsIik6CiAgICAgICAgICAgIHdpdGggQ2FyZEhlYWRlcigpOgogICAgICAgICAgICAgICAgQ2FyZFRpdGxlKCJSZWNlbnQgVHJhbnNhY3Rpb25zIikKICAgICAgICAgICAgd2l0aCBDYXJkQ29udGVudCgpOgogICAgICAgICAgICAgICAgRGl2KGNzc19jbGFzcz0iaC1mdWxsIGJnLWdyYWRpZW50LXRvLXIgZnJvbS1ncmF5LTEwMCB0by1ncmF5LTUwIHJvdW5kZWQtbWQiKQo">
  <CodeGroup>
    ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui.components import (
        Card, CardContent, CardHeader, CardTitle,
        Dashboard, DashboardItem,
        Div, H2, Muted,
    )

    with Dashboard(columns=12, row_height=100, gap=4):
        # Chart: columns 1-8, rows 1-3 (spans all three stat card rows)
        with DashboardItem(col=1, row=1, col_span=8, row_span=3):
            with Card(css_class="h-full"):
                with CardHeader():
                    CardTitle("Revenue Over Time")
                with CardContent():
                    Div(css_class="h-full bg-gradient-to-r from-blue-100 to-blue-50 rounded-md")

        # Stat cards: column 9-12, one per row
        with DashboardItem(col=9, row=1, col_span=4):
            with Card(css_class="h-full"):
                with CardHeader(css_class="pb-2"):
                    Muted("Total Revenue")
                with CardContent():
                    H2("$45,231")

        with DashboardItem(col=9, row=2, col_span=4):
            with Card(css_class="h-full"):
                with CardHeader(css_class="pb-2"):
                    Muted("Active Users")
                with CardContent():
                    H2("2,350")

        with DashboardItem(col=9, row=3, col_span=4):
            with Card(css_class="h-full"):
                with CardHeader(css_class="pb-2"):
                    Muted("Conversion Rate")
                with CardContent():
                    H2("3.2%")

        # Full-width table: all 12 columns, rows 4-5
        with DashboardItem(col=1, row=4, col_span=12, row_span=2):
            with Card(css_class="h-full"):
                with CardHeader():
                    CardTitle("Recent Transactions")
                with CardContent():
                    Div(css_class="h-full bg-gradient-to-r from-gray-100 to-gray-50 rounded-md")
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "cssClass": "gap-4",
        "type": "Dashboard",
        "columns": 12,
        "rowHeight": 100,
        "children": [
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 1,
            "colSpan": 8,
            "rowSpan": 3,
            "children": [
              {
                "cssClass": "h-full",
                "type": "Card",
                "children": [
                  {
                    "type": "CardHeader",
                    "children": [{"type": "CardTitle", "content": "Revenue Over Time"}]
                  },
                  {
                    "type": "CardContent",
                    "children": [
                      {
                        "cssClass": "h-full bg-gradient-to-r from-blue-100 to-blue-50 rounded-md",
                        "type": "Div"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 9,
            "row": 1,
            "colSpan": 4,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "h-full",
                "type": "Card",
                "children": [
                  {
                    "cssClass": "pb-2",
                    "type": "CardHeader",
                    "children": [{"content": "Total Revenue", "type": "Muted"}]
                  },
                  {"type": "CardContent", "children": [{"content": "$45,231", "type": "H2"}]}
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 9,
            "row": 2,
            "colSpan": 4,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "h-full",
                "type": "Card",
                "children": [
                  {
                    "cssClass": "pb-2",
                    "type": "CardHeader",
                    "children": [{"content": "Active Users", "type": "Muted"}]
                  },
                  {"type": "CardContent", "children": [{"content": "2,350", "type": "H2"}]}
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 9,
            "row": 3,
            "colSpan": 4,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "h-full",
                "type": "Card",
                "children": [
                  {
                    "cssClass": "pb-2",
                    "type": "CardHeader",
                    "children": [{"content": "Conversion Rate", "type": "Muted"}]
                  },
                  {"type": "CardContent", "children": [{"content": "3.2%", "type": "H2"}]}
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 4,
            "colSpan": 12,
            "rowSpan": 2,
            "children": [
              {
                "cssClass": "h-full",
                "type": "Card",
                "children": [
                  {
                    "type": "CardHeader",
                    "children": [{"type": "CardTitle", "content": "Recent Transactions"}]
                  },
                  {
                    "type": "CardContent",
                    "children": [
                      {
                        "cssClass": "h-full bg-gradient-to-r from-gray-100 to-gray-50 rounded-md",
                        "type": "Div"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Row Height

By default, every row in the grid is the same height — set by `row_height` in pixels. An item with `row_span=2` gets twice that height (plus one gap). The tabs below show the same layout at 80px and 150px row heights: same positions, different vertical scale.

<Tabs>
  <Tab title="80px rows">
    <ComponentPreview json={{"view":{"cssClass":"gap-3","type":"Dashboard","columns":3,"rowHeight":80,"children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":2,"rowSpan":1,"children":[{"cssClass":"bg-blue-500 rounded-md h-full","type":"Div"}]},{"type":"DashboardItem","col":3,"row":1,"colSpan":1,"rowSpan":1,"children":[{"cssClass":"bg-emerald-500 rounded-md h-full","type":"Div"}]},{"type":"DashboardItem","col":1,"row":2,"colSpan":3,"rowSpan":1,"children":[{"cssClass":"bg-purple-500 rounded-md h-full","type":"Div"}]}]}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cyBpbXBvcnQgRGFzaGJvYXJkLCBEYXNoYm9hcmRJdGVtLCBEaXYKCndpdGggRGFzaGJvYXJkKGNvbHVtbnM9Mywgcm93X2hlaWdodD04MCwgZ2FwPTMpOgogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0xLCByb3c9MSwgY29sX3NwYW49Mik6CiAgICAgICAgRGl2KGNzc19jbGFzcz0iYmctYmx1ZS01MDAgcm91bmRlZC1tZCBoLWZ1bGwiKQogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0zLCByb3c9MSk6CiAgICAgICAgRGl2KGNzc19jbGFzcz0iYmctZW1lcmFsZC01MDAgcm91bmRlZC1tZCBoLWZ1bGwiKQogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0xLCByb3c9MiwgY29sX3NwYW49Myk6CiAgICAgICAgRGl2KGNzc19jbGFzcz0iYmctcHVycGxlLTUwMCByb3VuZGVkLW1kIGgtZnVsbCIpCg">
      <CodeGroup>
        ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
        from prefab_ui.components import Dashboard, DashboardItem, Div

        with Dashboard(columns=3, row_height=80, gap=3):
            with DashboardItem(col=1, row=1, col_span=2):
                Div(css_class="bg-blue-500 rounded-md h-full")
            with DashboardItem(col=3, row=1):
                Div(css_class="bg-emerald-500 rounded-md h-full")
            with DashboardItem(col=1, row=2, col_span=3):
                Div(css_class="bg-purple-500 rounded-md h-full")
        ```

        ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
        {
          "view": {
            "cssClass": "gap-3",
            "type": "Dashboard",
            "columns": 3,
            "rowHeight": 80,
            "children": [
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 1,
                "colSpan": 2,
                "rowSpan": 1,
                "children": [{"cssClass": "bg-blue-500 rounded-md h-full", "type": "Div"}]
              },
              {
                "type": "DashboardItem",
                "col": 3,
                "row": 1,
                "colSpan": 1,
                "rowSpan": 1,
                "children": [{"cssClass": "bg-emerald-500 rounded-md h-full", "type": "Div"}]
              },
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 2,
                "colSpan": 3,
                "rowSpan": 1,
                "children": [{"cssClass": "bg-purple-500 rounded-md h-full", "type": "Div"}]
              }
            ]
          }
        }
        ```
      </CodeGroup>
    </ComponentPreview>
  </Tab>

  <Tab title="150px rows">
    <ComponentPreview json={{"view":{"cssClass":"gap-3","type":"Dashboard","columns":3,"rowHeight":150,"children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":2,"rowSpan":1,"children":[{"cssClass":"bg-blue-500 rounded-md h-full","type":"Div"}]},{"type":"DashboardItem","col":3,"row":1,"colSpan":1,"rowSpan":1,"children":[{"cssClass":"bg-emerald-500 rounded-md h-full","type":"Div"}]},{"type":"DashboardItem","col":1,"row":2,"colSpan":3,"rowSpan":1,"children":[{"cssClass":"bg-purple-500 rounded-md h-full","type":"Div"}]}]}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cyBpbXBvcnQgRGFzaGJvYXJkLCBEYXNoYm9hcmRJdGVtLCBEaXYKCndpdGggRGFzaGJvYXJkKGNvbHVtbnM9Mywgcm93X2hlaWdodD0xNTAsIGdhcD0zKToKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MSwgcm93PTEsIGNvbF9zcGFuPTIpOgogICAgICAgIERpdihjc3NfY2xhc3M9ImJnLWJsdWUtNTAwIHJvdW5kZWQtbWQgaC1mdWxsIikKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9Mywgcm93PTEpOgogICAgICAgIERpdihjc3NfY2xhc3M9ImJnLWVtZXJhbGQtNTAwIHJvdW5kZWQtbWQgaC1mdWxsIikKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MSwgcm93PTIsIGNvbF9zcGFuPTMpOgogICAgICAgIERpdihjc3NfY2xhc3M9ImJnLXB1cnBsZS01MDAgcm91bmRlZC1tZCBoLWZ1bGwiKQo">
      <CodeGroup>
        ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
        from prefab_ui.components import Dashboard, DashboardItem, Div

        with Dashboard(columns=3, row_height=150, gap=3):
            with DashboardItem(col=1, row=1, col_span=2):
                Div(css_class="bg-blue-500 rounded-md h-full")
            with DashboardItem(col=3, row=1):
                Div(css_class="bg-emerald-500 rounded-md h-full")
            with DashboardItem(col=1, row=2, col_span=3):
                Div(css_class="bg-purple-500 rounded-md h-full")
        ```

        ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
        {
          "view": {
            "cssClass": "gap-3",
            "type": "Dashboard",
            "columns": 3,
            "rowHeight": 150,
            "children": [
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 1,
                "colSpan": 2,
                "rowSpan": 1,
                "children": [{"cssClass": "bg-blue-500 rounded-md h-full", "type": "Div"}]
              },
              {
                "type": "DashboardItem",
                "col": 3,
                "row": 1,
                "colSpan": 1,
                "rowSpan": 1,
                "children": [{"cssClass": "bg-emerald-500 rounded-md h-full", "type": "Div"}]
              },
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 2,
                "colSpan": 3,
                "rowSpan": 1,
                "children": [{"cssClass": "bg-purple-500 rounded-md h-full", "type": "Div"}]
              }
            ]
          }
        }
        ```
      </CodeGroup>
    </ComponentPreview>
  </Tab>
</Tabs>

### Content-sized rows

Pass a string instead of an integer for CSS values. `row_height="auto"` makes each row size to its tallest item — so a row with a paragraph of text will be taller than a row with a single line. This is useful when your dashboard items have varying content and you want the grid to adapt rather than forcing fixed cells.

You can also use `row_height="minmax(80px, auto)"` to set a minimum height while still allowing rows to expand for taller content.

<ComponentPreview json={{"view":{"cssClass":"gap-3","type":"Dashboard","columns":3,"rowHeight":"auto","children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":2,"rowSpan":1,"children":[{"cssClass":"h-full","type":"Card","children":[{"type":"CardContent","children":[{"content":"This card has a paragraph of content, so the first row expands to fit. The green cell to the right stretches to match, even though its own content is short.","type":"P"}]}]}]},{"type":"DashboardItem","col":3,"row":1,"colSpan":1,"rowSpan":1,"children":[{"cssClass":"bg-emerald-500 rounded-md h-full flex items-center justify-center","type":"Div","children":[{"cssClass":"text-white font-semibold","content":"Stretches","type":"Text"}]}]},{"type":"DashboardItem","col":1,"row":2,"colSpan":3,"rowSpan":1,"children":[{"cssClass":"bg-purple-500 rounded-md h-full p-3 flex items-center","type":"Div","children":[{"cssClass":"text-white","content":"Row 2 has less content, so it's shorter.","type":"Text"}]}]}]}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cyBpbXBvcnQgKAogICAgQ2FyZCwgQ2FyZENvbnRlbnQsCiAgICBEYXNoYm9hcmQsIERhc2hib2FyZEl0ZW0sCiAgICBEaXYsIFAsIFRleHQsCikKCndpdGggRGFzaGJvYXJkKGNvbHVtbnM9Mywgcm93X2hlaWdodD0iYXV0byIsIGdhcD0zKToKICAgICMgUm93IDEg4oCUIHRoZSBjYXJkJ3MgcGFyYWdyYXBoIG1ha2VzIHRoaXMgcm93IHRhbGwKICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MSwgcm93PTEsIGNvbF9zcGFuPTIpOgogICAgICAgIHdpdGggQ2FyZChjc3NfY2xhc3M9ImgtZnVsbCIpOgogICAgICAgICAgICB3aXRoIENhcmRDb250ZW50KCk6CiAgICAgICAgICAgICAgICBQKCJUaGlzIGNhcmQgaGFzIGEgcGFyYWdyYXBoIG9mIGNvbnRlbnQsIHNvIHRoZSBmaXJzdCByb3cgIgogICAgICAgICAgICAgICAgICAiZXhwYW5kcyB0byBmaXQuIFRoZSBncmVlbiBjZWxsIHRvIHRoZSByaWdodCBzdHJldGNoZXMgIgogICAgICAgICAgICAgICAgICAidG8gbWF0Y2gsIGV2ZW4gdGhvdWdoIGl0cyBvd24gY29udGVudCBpcyBzaG9ydC4iKQogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0zLCByb3c9MSk6CiAgICAgICAgd2l0aCBEaXYoY3NzX2NsYXNzPSJiZy1lbWVyYWxkLTUwMCByb3VuZGVkLW1kIGgtZnVsbCBmbGV4IGl0ZW1zLWNlbnRlciBqdXN0aWZ5LWNlbnRlciIpOgogICAgICAgICAgICBUZXh0KCJTdHJldGNoZXMiLCBjc3NfY2xhc3M9InRleHQtd2hpdGUgZm9udC1zZW1pYm9sZCIpCgogICAgIyBSb3cgMiDigJQgc2hvcnQgY29udGVudCwgc28gdGhpcyByb3cgaXMgc21hbGxlcgogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0xLCByb3c9MiwgY29sX3NwYW49Myk6CiAgICAgICAgd2l0aCBEaXYoY3NzX2NsYXNzPSJiZy1wdXJwbGUtNTAwIHJvdW5kZWQtbWQgaC1mdWxsIHAtMyBmbGV4IGl0ZW1zLWNlbnRlciIpOgogICAgICAgICAgICBUZXh0KCJSb3cgMiBoYXMgbGVzcyBjb250ZW50LCBzbyBpdCdzIHNob3J0ZXIuIiwgY3NzX2NsYXNzPSJ0ZXh0LXdoaXRlIikK">
  <CodeGroup>
    ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui.components import (
        Card, CardContent,
        Dashboard, DashboardItem,
        Div, P, Text,
    )

    with Dashboard(columns=3, row_height="auto", gap=3):
        # Row 1 — the card's paragraph makes this row tall
        with DashboardItem(col=1, row=1, col_span=2):
            with Card(css_class="h-full"):
                with CardContent():
                    P("This card has a paragraph of content, so the first row "
                      "expands to fit. The green cell to the right stretches "
                      "to match, even though its own content is short.")
        with DashboardItem(col=3, row=1):
            with Div(css_class="bg-emerald-500 rounded-md h-full flex items-center justify-center"):
                Text("Stretches", css_class="text-white font-semibold")

        # Row 2 — short content, so this row is smaller
        with DashboardItem(col=1, row=2, col_span=3):
            with Div(css_class="bg-purple-500 rounded-md h-full p-3 flex items-center"):
                Text("Row 2 has less content, so it's shorter.", css_class="text-white")
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "cssClass": "gap-3",
        "type": "Dashboard",
        "columns": 3,
        "rowHeight": "auto",
        "children": [
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 1,
            "colSpan": 2,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "h-full",
                "type": "Card",
                "children": [
                  {
                    "type": "CardContent",
                    "children": [
                      {
                        "content": "This card has a paragraph of content, so the first row expands to fit. The green cell to the right stretches to match, even though its own content is short.",
                        "type": "P"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 3,
            "row": 1,
            "colSpan": 1,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "bg-emerald-500 rounded-md h-full flex items-center justify-center",
                "type": "Div",
                "children": [
                  {"cssClass": "text-white font-semibold", "content": "Stretches", "type": "Text"}
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 2,
            "colSpan": 3,
            "rowSpan": 1,
            "children": [
              {
                "cssClass": "bg-purple-500 rounded-md h-full p-3 flex items-center",
                "type": "Div",
                "children": [
                  {
                    "cssClass": "text-white",
                    "content": "Row 2 has less content, so it's shorter.",
                    "type": "Text"
                  }
                ]
              }
            ]
          }
        ]
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## Layering

When items overlap on the grid (their column/row ranges intersect), they stack visually. By default, later items render on top of earlier ones. Use `z_index` to control the stacking order explicitly — higher values render on top.

<ComponentPreview json={{"view":{"cssClass":"gap-2","type":"Dashboard","columns":6,"rowHeight":80,"children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":4,"rowSpan":2,"children":[{"cssClass":"bg-blue-500 rounded-md h-full flex items-center justify-center","type":"Div","children":[{"cssClass":"text-white font-semibold","content":"Background panel","type":"Text"}]}]},{"type":"DashboardItem","col":3,"row":1,"colSpan":4,"rowSpan":2,"zIndex":1,"children":[{"cssClass":"h-full border-2 border-amber-500","type":"Card","children":[{"cssClass":"flex items-center justify-center h-full","type":"CardContent","children":[{"cssClass":"font-semibold","content":"Overlay (z_index=1)","type":"Text"}]}]}]}]}}} playground="ZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cyBpbXBvcnQgKAogICAgQ2FyZCwgQ2FyZENvbnRlbnQsCiAgICBEYXNoYm9hcmQsIERhc2hib2FyZEl0ZW0sCiAgICBEaXYsIFRleHQsCikKCndpdGggRGFzaGJvYXJkKGNvbHVtbnM9Niwgcm93X2hlaWdodD04MCwgZ2FwPTIpOgogICAgIyBUaGlzIHBhbmVsIGNvdmVycyBjb2x1bW5zIDEtNAogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0xLCByb3c9MSwgY29sX3NwYW49NCwgcm93X3NwYW49Mik6CiAgICAgICAgd2l0aCBEaXYoY3NzX2NsYXNzPSJiZy1ibHVlLTUwMCByb3VuZGVkLW1kIGgtZnVsbCBmbGV4IGl0ZW1zLWNlbnRlciBqdXN0aWZ5LWNlbnRlciIpOgogICAgICAgICAgICBUZXh0KCJCYWNrZ3JvdW5kIHBhbmVsIiwgY3NzX2NsYXNzPSJ0ZXh0LXdoaXRlIGZvbnQtc2VtaWJvbGQiKQogICAgIyBUaGlzIGNhcmQgY292ZXJzIGNvbHVtbnMgMy02LCBvdmVybGFwcGluZyBjb2x1bW5zIDMtNAogICAgd2l0aCBEYXNoYm9hcmRJdGVtKGNvbD0zLCByb3c9MSwgY29sX3NwYW49NCwgcm93X3NwYW49Miwgel9pbmRleD0xKToKICAgICAgICB3aXRoIENhcmQoY3NzX2NsYXNzPSJoLWZ1bGwgYm9yZGVyLTIgYm9yZGVyLWFtYmVyLTUwMCIpOgogICAgICAgICAgICB3aXRoIENhcmRDb250ZW50KGNzc19jbGFzcz0iZmxleCBpdGVtcy1jZW50ZXIganVzdGlmeS1jZW50ZXIgaC1mdWxsIik6CiAgICAgICAgICAgICAgICBUZXh0KCJPdmVybGF5ICh6X2luZGV4PTEpIiwgY3NzX2NsYXNzPSJmb250LXNlbWlib2xkIikK">
  <CodeGroup>
    ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui.components import (
        Card, CardContent,
        Dashboard, DashboardItem,
        Div, Text,
    )

    with Dashboard(columns=6, row_height=80, gap=2):
        # This panel covers columns 1-4
        with DashboardItem(col=1, row=1, col_span=4, row_span=2):
            with Div(css_class="bg-blue-500 rounded-md h-full flex items-center justify-center"):
                Text("Background panel", css_class="text-white font-semibold")
        # This card covers columns 3-6, overlapping columns 3-4
        with DashboardItem(col=3, row=1, col_span=4, row_span=2, z_index=1):
            with Card(css_class="h-full border-2 border-amber-500"):
                with CardContent(css_class="flex items-center justify-center h-full"):
                    Text("Overlay (z_index=1)", css_class="font-semibold")
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "cssClass": "gap-2",
        "type": "Dashboard",
        "columns": 6,
        "rowHeight": 80,
        "children": [
          {
            "type": "DashboardItem",
            "col": 1,
            "row": 1,
            "colSpan": 4,
            "rowSpan": 2,
            "children": [
              {
                "cssClass": "bg-blue-500 rounded-md h-full flex items-center justify-center",
                "type": "Div",
                "children": [
                  {
                    "cssClass": "text-white font-semibold",
                    "content": "Background panel",
                    "type": "Text"
                  }
                ]
              }
            ]
          },
          {
            "type": "DashboardItem",
            "col": 3,
            "row": 1,
            "colSpan": 4,
            "rowSpan": 2,
            "zIndex": 1,
            "children": [
              {
                "cssClass": "h-full border-2 border-amber-500",
                "type": "Card",
                "children": [
                  {
                    "cssClass": "flex items-center justify-center h-full",
                    "type": "CardContent",
                    "children": [
                      {"cssClass": "font-semibold", "content": "Overlay (z_index=1)", "type": "Text"}
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## API Reference

<Card icon="code" title="Dashboard Parameters">
  <ParamField body="columns" type="int" default="12">
    Number of grid columns.
  </ParamField>

  <ParamField body="row_height" type="int | str" default="120">
    Height of each auto-generated row. Integer for pixels, string for any CSS value (e.g. `"auto"`, `"minmax(100px, auto)"`).
  </ParamField>

  <ParamField body="rows" type="int | None" default="None">
    Fixed number of rows. When set, uses `grid-template-rows` instead of `grid-auto-rows`. Omit for auto-expanding rows.
  </ParamField>

  <ParamField body="gap" type="int | tuple | Responsive | None" default="None">
    Gap between items. An int maps to `gap-{n}`. A tuple `(x, y)` sets per-axis gaps.
  </ParamField>

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

<Card icon="code" title="DashboardItem Parameters">
  <ParamField body="col" type="int" default="1">
    Starting column (1-indexed).
  </ParamField>

  <ParamField body="row" type="int" default="1">
    Starting row (1-indexed).
  </ParamField>

  <ParamField body="col_span" type="int" default="1">
    Number of columns to span.
  </ParamField>

  <ParamField body="row_span" type="int" default="1">
    Number of rows to span.
  </ParamField>

  <ParamField body="z_index" type="int | None" default="None">
    CSS z-index for layering overlapping items.
  </ParamField>

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

## Protocol Reference

```json Dashboard theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "Dashboard",
  "id?": "string",
  "onMount?": "any",
  "children?": "[Component]",
  "let?": "object",
  "columns?": 12,
  "rowHeight?": "number | string",
  "rows?": "number",
  "gap?": "number | [number, number]",
  "cssClass?": "string"
}
```

```json DashboardItem theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "DashboardItem",
  "id?": "string",
  "onMount?": "any",
  "children?": "[Component]",
  "let?": "object",
  "col?": 1,
  "row?": 1,
  "colSpan?": 1,
  "rowSpan?": 1,
  "zIndex?": "number",
  "cssClass?": "string"
}
```

For the complete protocol schema, see [Dashboard](/docs/protocol/dashboard), [DashboardItem](/docs/protocol/dashboard-item).
