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

# Cross-Filtering

> A regional dashboard where a single dropdown instantly filters every chart and metric.

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

A dashboard where one control filters everything. Pick a region from the dropdown and every metric, bar chart, radar chart, and trend line updates instantly — no server round-trip, no page reload. This is the pattern that makes Prefab's client-side state model fundamentally different from frameworks that rerun your script on every interaction.

<ComponentPreview json={{"view":{"cssClass":"pf-app-root max-w-none p-0","type":"Div","children":[{"cssClass":"gap-4","let":{"m":"{{ region == 'north' ? metrics_north : region == 'south' ? metrics_south : region == 'east' ? metrics_east : region == 'west' ? metrics_west : metrics_all }}","chart":"{{ region == 'north' ? monthly_north : region == 'south' ? monthly_south : region == 'east' ? monthly_east : region == 'west' ? monthly_west : monthly_all }}","cat":"{{ region == 'north' ? categories_north : region == 'south' ? categories_south : region == 'east' ? categories_east : region == 'west' ? categories_west : categories_all }}","t":"{{ region == 'north' ? trend_north : region == 'south' ? trend_south : region == 'east' ? trend_east : region == 'west' ? trend_west : trend_all }}"},"type":"Dashboard","columns":12,"rowHeight":"auto","children":[{"type":"DashboardItem","col":1,"row":1,"colSpan":12,"rowSpan":1,"children":[{"type":"Card","children":[{"type":"CardContent","children":[{"cssClass":"gap-4 items-center","type":"Row","children":[{"content":"Region","type":"Muted"},{"cssClass":"w-48","name":"region","type":"Select","size":"default","disabled":false,"required":false,"invalid":false,"children":[{"type":"SelectOption","value":"all","label":"All Regions","selected":false,"disabled":false},{"type":"SelectOption","value":"north","label":"North","selected":false,"disabled":false},{"type":"SelectOption","value":"south","label":"South","selected":false,"disabled":false},{"type":"SelectOption","value":"east","label":"East","selected":false,"disabled":false},{"type":"SelectOption","value":"west","label":"West","selected":false,"disabled":false}]}]}]}]}]},{"type":"DashboardItem","col":1,"row":2,"colSpan":3,"rowSpan":1,"children":[{"type":"Metric","label":"Revenue","value":"{{ m.revenue | currency }}"}]},{"type":"DashboardItem","col":4,"row":2,"colSpan":3,"rowSpan":1,"children":[{"type":"Metric","label":"Units Sold","value":"{{ m.units | number }}"}]},{"type":"DashboardItem","col":7,"row":2,"colSpan":3,"rowSpan":1,"children":[{"type":"Metric","label":"Avg Price","value":"{{ m.avg_price | currency }}"}]},{"type":"DashboardItem","col":10,"row":2,"colSpan":3,"rowSpan":1,"children":[{"type":"Metric","label":"Stores","value":"{{ m.stores }}"}]},{"type":"DashboardItem","col":1,"row":3,"colSpan":7,"rowSpan":1,"children":[{"cssClass":"h-full","type":"Card","children":[{"type":"CardHeader","children":[{"type":"CardTitle","content":"Monthly Sales"}]},{"type":"CardContent","children":[{"type":"BarChart","data":"{{ chart }}","series":[{"dataKey":"sales","label":"Sales","color":"#2563eb"},{"dataKey":"returns","label":"Returns","color":"#e76e50"}],"xAxis":"month","height":250,"stacked":true,"horizontal":false,"barRadius":0,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"auto"}]}]}]},{"type":"DashboardItem","col":8,"row":3,"colSpan":5,"rowSpan":1,"children":[{"cssClass":"h-full","type":"Card","children":[{"type":"CardHeader","children":[{"type":"CardTitle","content":"Category Performance"}]},{"type":"CardContent","children":[{"type":"RadarChart","data":"{{ cat }}","series":[{"dataKey":"score","label":"Score"}],"axisKey":"category","height":250,"filled":true,"showDots":true,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true}]}]}]},{"type":"DashboardItem","col":1,"row":4,"colSpan":12,"rowSpan":1,"children":[{"type":"Card","children":[{"type":"CardHeader","children":[{"type":"CardTitle","content":"Revenue Trend (12 months)"}]},{"type":"CardContent","children":[{"type":"LineChart","data":"{{ t }}","series":[{"dataKey":"revenue","label":"Revenue","color":"#2563eb"}],"xAxis":"month","height":200,"curve":"smooth","showDots":true,"showLegend":true,"showTooltip":true,"animate":true,"showGrid":true,"showYAxis":true,"valueFormat":"auto"}]}]}]}]}]},"state":{"region":"all","metrics_all":{"revenue":284750,"units":12450,"avg_price":22.87,"stores":48},"metrics_north":{"revenue":142800,"units":4200,"avg_price":34.0,"stores":8},"metrics_south":{"revenue":38900,"units":3850,"avg_price":10.1,"stores":18},"metrics_east":{"revenue":67200,"units":1680,"avg_price":40.0,"stores":6},"metrics_west":{"revenue":35850,"units":2720,"avg_price":13.18,"stores":16},"monthly_all":[{"month":"Jan","sales":42000,"returns":3200},{"month":"Feb","sales":48500,"returns":3800},{"month":"Mar","sales":45200,"returns":3400},{"month":"Apr","sales":51800,"returns":4100},{"month":"May","sales":47600,"returns":3600},{"month":"Jun","sales":53200,"returns":4200}],"monthly_north":[{"month":"Jan","sales":22000,"returns":800},{"month":"Feb","sales":25500,"returns":900},{"month":"Mar","sales":24200,"returns":850},{"month":"Apr","sales":27800,"returns":1000},{"month":"May","sales":23100,"returns":750},{"month":"Jun","sales":29200,"returns":1100}],"monthly_south":[{"month":"Jan","sales":5800,"returns":1200},{"month":"Feb","sales":6400,"returns":1400},{"month":"Mar","sales":5600,"returns":1100},{"month":"Apr","sales":7200,"returns":1600},{"month":"May","sales":6100,"returns":1300},{"month":"Jun","sales":7800,"returns":1700}],"monthly_east":[{"month":"Jan","sales":8200,"returns":400},{"month":"Feb","sales":10600,"returns":500},{"month":"Mar","sales":9800,"returns":450},{"month":"Apr","sales":11800,"returns":550},{"month":"May","sales":12400,"returns":500},{"month":"Jun","sales":14200,"returns":600}],"monthly_west":[{"month":"Jan","sales":6000,"returns":800},{"month":"Feb","sales":6000,"returns":1000},{"month":"Mar","sales":5600,"returns":1000},{"month":"Apr","sales":5000,"returns":950},{"month":"May","sales":6000,"returns":1050},{"month":"Jun","sales":2000,"returns":800}],"categories_all":[{"category":"Electronics","score":82},{"category":"Clothing","score":75},{"category":"Home","score":80},{"category":"Books","score":65},{"category":"Sports","score":70}],"categories_north":[{"category":"Electronics","score":98},{"category":"Clothing","score":40},{"category":"Home","score":92},{"category":"Books","score":35},{"category":"Sports","score":45}],"categories_south":[{"category":"Electronics","score":45},{"category":"Clothing","score":95},{"category":"Home","score":50},{"category":"Books","score":90},{"category":"Sports","score":88}],"categories_east":[{"category":"Electronics","score":95},{"category":"Clothing","score":60},{"category":"Home","score":90},{"category":"Books","score":55},{"category":"Sports","score":40}],"categories_west":[{"category":"Electronics","score":50},{"category":"Clothing","score":88},{"category":"Home","score":55},{"category":"Books","score":82},{"category":"Sports","score":92}],"trend_all":[{"month":"Mar","revenue":32000},{"month":"Apr","revenue":35000},{"month":"May","revenue":33500},{"month":"Jun","revenue":38000},{"month":"Jul","revenue":41000},{"month":"Aug","revenue":39500},{"month":"Sep","revenue":43000},{"month":"Oct","revenue":45500},{"month":"Nov","revenue":48000},{"month":"Dec","revenue":52000},{"month":"Jan","revenue":49000},{"month":"Feb","revenue":54000}],"trend_north":[{"month":"Mar","revenue":18000},{"month":"Apr","revenue":20500},{"month":"May","revenue":19000},{"month":"Jun","revenue":22000},{"month":"Jul","revenue":24500},{"month":"Aug","revenue":23000},{"month":"Sep","revenue":26000},{"month":"Oct","revenue":28000},{"month":"Nov","revenue":30000},{"month":"Dec","revenue":35000},{"month":"Jan","revenue":32000},{"month":"Feb","revenue":38000}],"trend_south":[{"month":"Mar","revenue":4200},{"month":"Apr","revenue":4800},{"month":"May","revenue":5100},{"month":"Jun","revenue":5500},{"month":"Jul","revenue":5200},{"month":"Aug","revenue":5800},{"month":"Sep","revenue":5500},{"month":"Oct","revenue":6000},{"month":"Nov","revenue":5800},{"month":"Dec","revenue":6200},{"month":"Jan","revenue":6000},{"month":"Feb","revenue":6500}],"trend_east":[{"month":"Mar","revenue":5500},{"month":"Apr","revenue":6200},{"month":"May","revenue":7000},{"month":"Jun","revenue":7800},{"month":"Jul","revenue":8800},{"month":"Aug","revenue":9500},{"month":"Sep","revenue":10500},{"month":"Oct","revenue":11500},{"month":"Nov","revenue":12800},{"month":"Dec","revenue":14000},{"month":"Jan","revenue":15500},{"month":"Feb","revenue":17000}],"trend_west":[{"month":"Mar","revenue":8500},{"month":"Apr","revenue":8200},{"month":"May","revenue":7800},{"month":"Jun","revenue":7200},{"month":"Jul","revenue":6800},{"month":"Aug","revenue":6500},{"month":"Sep","revenue":6000},{"month":"Oct","revenue":5500},{"month":"Nov","revenue":5200},{"month":"Dec","revenue":4800},{"month":"Jan","revenue":4200},{"month":"Feb","revenue":3500}]}}} playground="ZnJvbSBwcmVmYWJfdWkgaW1wb3J0IFByZWZhYkFwcApmcm9tIHByZWZhYl91aS5jb21wb25lbnRzIGltcG9ydCAoCiAgICBDYXJkLCBDYXJkQ29udGVudCwgQ2FyZEhlYWRlciwgQ2FyZFRpdGxlLAogICAgRGFzaGJvYXJkLCBEYXNoYm9hcmRJdGVtLAogICAgTXV0ZWQsIFJvdywgU2VsZWN0LCBTZWxlY3RPcHRpb24sCikKZnJvbSBwcmVmYWJfdWkuY29tcG9uZW50cy5jaGFydHMgaW1wb3J0IEJhckNoYXJ0LCBDaGFydFNlcmllcywgTGluZUNoYXJ0LCBSYWRhckNoYXJ0CmZyb20gcHJlZmFiX3VpLmNvbXBvbmVudHMubWV0cmljIGltcG9ydCBNZXRyaWMKZnJvbSBwcmVmYWJfdWkucnggaW1wb3J0IFJ4CgojIFByZS1zZWdtZW50ZWQgZGF0YSBmb3IgZWFjaCByZWdpb24uIFRoZSBTZWxlY3Qgd3JpdGVzIHRvIGByZWdpb25gIGluIHN0YXRlLAojIGFuZCBhIGBsZXRgIGJpbmRpbmcgcGlja3MgdGhlIHJpZ2h0IGRhdGFzZXQgdmlhIGEgdGVybmFyeSBjaGFpbi4KClJFR0lPTlMgPSBbImFsbCIsICJub3J0aCIsICJzb3V0aCIsICJlYXN0IiwgIndlc3QiXQoKbWV0cmljcyA9IHsKICAgICJhbGwiOiAgIHsicmV2ZW51ZSI6IDI4NDc1MCwgInVuaXRzIjogMTI0NTAsICJhdmdfcHJpY2UiOiAyMi44NywgInN0b3JlcyI6IDQ4fSwKICAgICJub3J0aCI6IHsicmV2ZW51ZSI6IDE0MjgwMCwgInVuaXRzIjogNDIwMCwgICJhdmdfcHJpY2UiOiAzNC4wMCwgInN0b3JlcyI6IDh9LAogICAgInNvdXRoIjogeyJyZXZlbnVlIjogMzg5MDAsICAidW5pdHMiOiAzODUwLCAgImF2Z19wcmljZSI6IDEwLjEwLCAic3RvcmVzIjogMTh9LAogICAgImVhc3QiOiAgeyJyZXZlbnVlIjogNjcyMDAsICAidW5pdHMiOiAxNjgwLCAgImF2Z19wcmljZSI6IDQwLjAwLCAic3RvcmVzIjogNn0sCiAgICAid2VzdCI6ICB7InJldmVudWUiOiAzNTg1MCwgICJ1bml0cyI6IDI3MjAsICAiYXZnX3ByaWNlIjogMTMuMTgsICJzdG9yZXMiOiAxNn0sCn0KCm1vbnRobHkgPSB7CiAgICAiYWxsIjogWwogICAgICAgIHsibW9udGgiOiAiSmFuIiwgInNhbGVzIjogNDIwMDAsICJyZXR1cm5zIjogMzIwMH0sCiAgICAgICAgeyJtb250aCI6ICJGZWIiLCAic2FsZXMiOiA0ODUwMCwgInJldHVybnMiOiAzODAwfSwKICAgICAgICB7Im1vbnRoIjogIk1hciIsICJzYWxlcyI6IDQ1MjAwLCAicmV0dXJucyI6IDM0MDB9LAogICAgICAgIHsibW9udGgiOiAiQXByIiwgInNhbGVzIjogNTE4MDAsICJyZXR1cm5zIjogNDEwMH0sCiAgICAgICAgeyJtb250aCI6ICJNYXkiLCAic2FsZXMiOiA0NzYwMCwgInJldHVybnMiOiAzNjAwfSwKICAgICAgICB7Im1vbnRoIjogIkp1biIsICJzYWxlcyI6IDUzMjAwLCAicmV0dXJucyI6IDQyMDB9LAogICAgXSwKICAgICJub3J0aCI6IFsKICAgICAgICB7Im1vbnRoIjogIkphbiIsICJzYWxlcyI6IDIyMDAwLCAicmV0dXJucyI6IDgwMH0sCiAgICAgICAgeyJtb250aCI6ICJGZWIiLCAic2FsZXMiOiAyNTUwMCwgInJldHVybnMiOiA5MDB9LAogICAgICAgIHsibW9udGgiOiAiTWFyIiwgInNhbGVzIjogMjQyMDAsICJyZXR1cm5zIjogODUwfSwKICAgICAgICB7Im1vbnRoIjogIkFwciIsICJzYWxlcyI6IDI3ODAwLCAicmV0dXJucyI6IDEwMDB9LAogICAgICAgIHsibW9udGgiOiAiTWF5IiwgInNhbGVzIjogMjMxMDAsICJyZXR1cm5zIjogNzUwfSwKICAgICAgICB7Im1vbnRoIjogIkp1biIsICJzYWxlcyI6IDI5MjAwLCAicmV0dXJucyI6IDExMDB9LAogICAgXSwKICAgICJzb3V0aCI6IFsKICAgICAgICB7Im1vbnRoIjogIkphbiIsICJzYWxlcyI6IDU4MDAsICAicmV0dXJucyI6IDEyMDB9LAogICAgICAgIHsibW9udGgiOiAiRmViIiwgInNhbGVzIjogNjQwMCwgICJyZXR1cm5zIjogMTQwMH0sCiAgICAgICAgeyJtb250aCI6ICJNYXIiLCAic2FsZXMiOiA1NjAwLCAgInJldHVybnMiOiAxMTAwfSwKICAgICAgICB7Im1vbnRoIjogIkFwciIsICJzYWxlcyI6IDcyMDAsICAicmV0dXJucyI6IDE2MDB9LAogICAgICAgIHsibW9udGgiOiAiTWF5IiwgInNhbGVzIjogNjEwMCwgICJyZXR1cm5zIjogMTMwMH0sCiAgICAgICAgeyJtb250aCI6ICJKdW4iLCAic2FsZXMiOiA3ODAwLCAgInJldHVybnMiOiAxNzAwfSwKICAgIF0sCiAgICAiZWFzdCI6IFsKICAgICAgICB7Im1vbnRoIjogIkphbiIsICJzYWxlcyI6IDgyMDAsICAicmV0dXJucyI6IDQwMH0sCiAgICAgICAgeyJtb250aCI6ICJGZWIiLCAic2FsZXMiOiAxMDYwMCwgInJldHVybnMiOiA1MDB9LAogICAgICAgIHsibW9udGgiOiAiTWFyIiwgInNhbGVzIjogOTgwMCwgICJyZXR1cm5zIjogNDUwfSwKICAgICAgICB7Im1vbnRoIjogIkFwciIsICJzYWxlcyI6IDExODAwLCAicmV0dXJucyI6IDU1MH0sCiAgICAgICAgeyJtb250aCI6ICJNYXkiLCAic2FsZXMiOiAxMjQwMCwgInJldHVybnMiOiA1MDB9LAogICAgICAgIHsibW9udGgiOiAiSnVuIiwgInNhbGVzIjogMTQyMDAsICJyZXR1cm5zIjogNjAwfSwKICAgIF0sCiAgICAid2VzdCI6IFsKICAgICAgICB7Im1vbnRoIjogIkphbiIsICJzYWxlcyI6IDYwMDAsICAicmV0dXJucyI6IDgwMH0sCiAgICAgICAgeyJtb250aCI6ICJGZWIiLCAic2FsZXMiOiA2MDAwLCAgInJldHVybnMiOiAxMDAwfSwKICAgICAgICB7Im1vbnRoIjogIk1hciIsICJzYWxlcyI6IDU2MDAsICAicmV0dXJucyI6IDEwMDB9LAogICAgICAgIHsibW9udGgiOiAiQXByIiwgInNhbGVzIjogNTAwMCwgICJyZXR1cm5zIjogOTUwfSwKICAgICAgICB7Im1vbnRoIjogIk1heSIsICJzYWxlcyI6IDYwMDAsICAicmV0dXJucyI6IDEwNTB9LAogICAgICAgIHsibW9udGgiOiAiSnVuIiwgInNhbGVzIjogMjAwMCwgICJyZXR1cm5zIjogODAwfSwKICAgIF0sCn0KCmNhdGVnb3JpZXMgPSB7CiAgICAiYWxsIjogICBbeyJjYXRlZ29yeSI6ICJFbGVjdHJvbmljcyIsICJzY29yZSI6IDgyfSwgeyJjYXRlZ29yeSI6ICJDbG90aGluZyIsICJzY29yZSI6IDc1fSwgeyJjYXRlZ29yeSI6ICJIb21lIiwgInNjb3JlIjogODB9LCB7ImNhdGVnb3J5IjogIkJvb2tzIiwgInNjb3JlIjogNjV9LCB7ImNhdGVnb3J5IjogIlNwb3J0cyIsICJzY29yZSI6IDcwfV0sCiAgICAibm9ydGgiOiBbeyJjYXRlZ29yeSI6ICJFbGV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FyIiwgInJldmVudWUiOiAzMjAwMH0sIHsibW9udGgiOiAiQXByIiwgInJldmVudWUiOiAzNTAwMH0sIHsibW9udGgiOiAiTWF5IiwgInJldmVudWUiOiAzMzUwMH0sIHsibW9udGgiOiAiSnVuIiwgInJldmVudWUiOiAzODAwMH0sIHsibW9udGgiOiAiSnVsIiwgInJldmVudWUiOiA0MTAwMH0sIHsibW9udGgiOiAiQXVnIiwgInJldmVudWUiOiAzOTUwMH0sIHsibW9udGgiOiAiU2VwIiwgInJldmVudWUiOiA0MzAwMH0sIHsibW9udGgiOiAiT2N0IiwgInJldmVudWUiOiA0NTUwMH0sIHsibW9udGgiOiAiTm92IiwgInJldmVudWUiOiA0ODAwMH0sIHsibW9udGgiOiAiRGVjIiwgInJldmVudWUiOiA1MjAwMH0sIHsibW9udGgiOiAiSmFuIiwgInJldmVudWUiOiA0OTAwMH0sIHsibW9udGgiOiAiRmViIiwgInJldmVudWUiOiA1NDAwMH1dLAogICAgIm5vcnRoIjogW3sibW9udGgiOiAiTWFyIiwgInJldmVudWUiOiAxODAwMH0sIHsibW9udGgiOiAiQXByIiwgInJldmVudWUiOiAyMDUwMH0sIHsibW9udGgiOiAiTWF5IiwgInJldmVudWUiOiAxOTAwMH0sIHsibW9udGgiOiAiSnVuIiwgInJldmVudWUiOiAyMjAwMH0sIHsibW9udGgiOiAiSnVsIiwgInJldmVudWUiOiAyNDUwMH0sIHsibW9udGgiOiAiQXVnIiwgInJldmVudWUiOiAyMzAwMH0sIHsibW9udGgiOiAiU2VwIiwgInJldmVudWUiOiAyNjAwMH0sIHsibW9udGgiOiAiT2N0IiwgInJldmVudWUiOiAyODAwMH0sIHsibW9udGgiOiAiTm92IiwgInJldmVudWUiOiAzMDAwMH0sIHsibW9udGgiOiAiRGVjIiwgInJldmVudWUiOiAzNTAwMH0sIHsibW9udGgiOiAiSmFuIiwgInJldmVudWUiOiAzMjAwMH0sIHsibW9udGgiOiAiRmViIiwgInJldmVudWUiOiAzODAwMH1dL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F0IjogcGljaygiY2F0ZWdvcmllcyIpLAogICAgICAgICAgICAidCI6IHBpY2soInRyZW5kIiksCiAgICAgICAgfSwKICAgICk6CiAgICAgICAgIyBSb3cgMTogUmVnaW9uIGZpbHRlcgogICAgICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MSwgcm93PTEsIGNvbF9zcGFuPTEyKToKICAgICAgICAgICAgd2l0aCBDYXJkKCk6CiAgICAgICAgICAgICAgICB3aXRoIENhcmRDb250ZW50KCk6CiAgICAgICAgICAgICAgICAgICAgd2l0aCBSb3coYWxpZ249ImNlbnRlciIsIGdhcD00KToKICAgICAgICAgICAgICAgICAgICAgICAgTXV0ZWQoIlJlZ2lvbiIpCiAgICAgICAgICAgICAgICAgICAgICAgIHdpdGggU2VsZWN0KG5hbWU9InJlZ2lvbiIsIGNzc19jbGFzcz0idy00OCIpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VsZWN0T3B0aW9uKHZhbHVlPSJhbGwiLCBsYWJlbD0iQWxsIFJlZ2lvbnMiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VsZWN0T3B0aW9uKHZhbHVlPSJub3J0aCIsIGxhYmVsPSJOb3J0aCIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZWxlY3RPcHRpb24odmFsdWU9InNvdXRoIiwgbGFiZWw9IlNvdXRoIikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdE9wdGlvbih2YWx1ZT0iZWFzdCIsIGxhYmVsPSJFYXN0IikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlbGVjdE9wdGlvbih2YWx1ZT0id2VzdCIsIGxhYmVsPSJXZXN0IikKCiAgICAgICAgIyBSb3cgMjogTWV0cmljcyDigJQgYWxsIGRyaXZlbiBieSBgbWAgZnJvbSB0aGUgbGV0IGJpbmRpbmcKICAgICAgICBtID0gUngoIm0iKQogICAgICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MSwgcm93PTIsIGNvbF9zcGFuPTMpOgogICAgICAgICAgICBNZXRyaWMobGFiZWw9IlJldmVudWUiLCB2YWx1ZT1tLnJldmVudWUuY3VycmVuY3koKSkKICAgICAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTQsIHJvdz0yLCBjb2xfc3Bhbj0zKToKICAgICAgICAgICAgTWV0cmljKGxhYmVsPSJVbml0cyBTb2xkIiwgdmFsdWU9bS51bml0cy5udW1iZXIoKSkKICAgICAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTcsIHJvdz0yLCBjb2xfc3Bhbj0zKToKICAgICAgICAgICAgTWV0cmljKGxhYmVsPSJBdmcgUHJpY2UiLCB2YWx1ZT1tLmF2Z19wcmljZS5jdXJyZW5jeSgpKQogICAgICAgIHdpdGggRGFzaGJvYXJkSXRlbShjb2w9MTAsIHJvdz0yLCBjb2xfc3Bhbj0zKToKICAgICAgICAgICAgTWV0cmljKGxhYmVsPSJTdG9yZXMiLCB2YWx1ZT1tLnN0b3JlcykKCiAgICAgICAgIyBSb3cgMzogQmFyIGNoYXJ0ICsgcmFkYXIgY2hhcnQKICAgICAgICBjaGFydCA9IFJ4KCJjaGFydCIpCiAgICAgICAgY2F0ID0gUngoImNhdCIpCiAgICAgICAgdCA9IFJ4KCJ0IikKICAgICAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTEsIHJvdz0zLCBjb2xfc3Bhbj03KToKICAgICAgICAgICAgd2l0aCBDYXJkKGNzc19jbGFzcz0iaC1mdWxsIik6CiAgICAgICAgICAgICAgICB3aXRoIENhcmRIZWFkZXIoKToKICAgICAgICAgICAgICAgICAgICBDYXJkVGl0bGUoIk1vbnRobHkgU2FsZXMiKQogICAgICAgICAgICAgICAgd2l0aCBDYXJkQ29udGVudCgpOgogICAgICAgICAgICAgICAgICAgIEJhckNoYXJ0KAogICAgICAgICAgICAgICAgICAgICAgICBkYXRhPWNoYXJ0LAogICAgICAgICAgICAgICAgICAgICAgICBzZXJpZXM9WwogICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2hhcnRTZXJpZXMoZGF0YV9rZXk9InNhbGVzIiwgbGFiZWw9IlNhbGVzIiwgY29sb3I9IiMyNTYzZWIiKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJ0U2VyaWVzKGRhdGFfa2V5PSJyZXR1cm5zIiwgbGFiZWw9IlJldHVybnMiLCBjb2xvcj0iI2U3NmU1MCIpLAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICB4X2F4aXM9Im1vbnRoIiwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tlZD1UcnVlLAogICAgICAgICAgICAgICAgICAgICAgICBiYXJfcmFkaXVzPTAsCiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dfbGVnZW5kPVRydWUsCiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodD0yNTAsCiAgICAgICAgICAgICAgICAgICAgKQoKICAgICAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTgsIHJvdz0zLCBjb2xfc3Bhbj01KToKICAgICAgICAgICAgd2l0aCBDYXJkKGNzc19jbGFzcz0iaC1mdWxsIik6CiAgICAgICAgICAgICAgICB3aXRoIENhcmRIZWFkZXIoKToKICAgICAgICAgICAgICAgICAgICBDYXJkVGl0bGUoIkNhdGVnb3J5IFBlcmZvcm1hbmNlIikKICAgICAgICAgICAgICAgIHdpdGggQ2FyZENvbnRlbnQoKToKICAgICAgICAgICAgICAgICAgICBSYWRhckNoYXJ0KAogICAgICAgICAgICAgICAgICAgICAgICBkYXRhPWNhdCwKICAgICAgICAgICAgICAgICAgICAgICAgc2VyaWVzPVtDaGFydFNlcmllcyhkYXRhX2tleT0ic2NvcmUiLCBsYWJlbD0iU2NvcmUiKV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGF4aXNfa2V5PSJjYXRlZ29yeSIsCiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dfZG90cz1UcnVlLAogICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ9MjUwLAogICAgICAgICAgICAgICAgICAgICkKCiAgICAgICAgIyBSb3cgNDogMTItbW9udGggdHJlbmQKICAgICAgICB3aXRoIERhc2hib2FyZEl0ZW0oY29sPTEsIHJvdz00LCBjb2xfc3Bhbj0xMik6CiAgICAgICAgICAgIHdpdGggQ2FyZCgpOgogICAgICAgICAgICAgICAgd2l0aCBDYXJkSGVhZGVyKCk6CiAgICAgICAgICAgICAgICAgICAgQ2FyZFRpdGxlKCJSZXZlbnVlIFRyZW5kICgxMiBtb250aHMpIikKICAgICAgICAgICAgICAgIHdpdGggQ2FyZENvbnRlbnQoKToKICAgICAgICAgICAgICAgICAgICBMaW5lQ2hhcnQoCiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE9dCwKICAgICAgICAgICAgICAgICAgICAgICAgc2VyaWVzPVtDaGFydFNlcmllcyhkYXRhX2tleT0icmV2ZW51ZSIsIGxhYmVsPSJSZXZlbnVlIiwgY29sb3I9IiMyNTYzZWIiKV0sCiAgICAgICAgICAgICAgICAgICAgICAgIHhfYXhpcz0ibW9udGgiLAogICAgICAgICAgICAgICAgICAgICAgICBjdXJ2ZT0ic21vb3RoIiwKICAgICAgICAgICAgICAgICAgICAgICAgc2hvd19kb3RzPVRydWUsCiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodD0yMDAsCiAgICAgICAgICAgICAgICAgICAgKQo">
  <CodeGroup>
    ```python Python icon="python" expandable theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    from prefab_ui import PrefabApp
    from prefab_ui.components import (
        Card, CardContent, CardHeader, CardTitle,
        Dashboard, DashboardItem,
        Muted, Row, Select, SelectOption,
    )
    from prefab_ui.components.charts import BarChart, ChartSeries, LineChart, RadarChart
    from prefab_ui.components.metric import Metric
    from prefab_ui.rx import Rx

    # Pre-segmented data for each region. The Select writes to `region` in state,
    # and a `let` binding picks the right dataset via a ternary chain.

    REGIONS = ["all", "north", "south", "east", "west"]

    metrics = {
        "all":   {"revenue": 284750, "units": 12450, "avg_price": 22.87, "stores": 48},
        "north": {"revenue": 142800, "units": 4200,  "avg_price": 34.00, "stores": 8},
        "south": {"revenue": 38900,  "units": 3850,  "avg_price": 10.10, "stores": 18},
        "east":  {"revenue": 67200,  "units": 1680,  "avg_price": 40.00, "stores": 6},
        "west":  {"revenue": 35850,  "units": 2720,  "avg_price": 13.18, "stores": 16},
    }

    monthly = {
        "all": [
            {"month": "Jan", "sales": 42000, "returns": 3200},
            {"month": "Feb", "sales": 48500, "returns": 3800},
            {"month": "Mar", "sales": 45200, "returns": 3400},
            {"month": "Apr", "sales": 51800, "returns": 4100},
            {"month": "May", "sales": 47600, "returns": 3600},
            {"month": "Jun", "sales": 53200, "returns": 4200},
        ],
        "north": [
            {"month": "Jan", "sales": 22000, "returns": 800},
            {"month": "Feb", "sales": 25500, "returns": 900},
            {"month": "Mar", "sales": 24200, "returns": 850},
            {"month": "Apr", "sales": 27800, "returns": 1000},
            {"month": "May", "sales": 23100, "returns": 750},
            {"month": "Jun", "sales": 29200, "returns": 1100},
        ],
        "south": [
            {"month": "Jan", "sales": 5800,  "returns": 1200},
            {"month": "Feb", "sales": 6400,  "returns": 1400},
            {"month": "Mar", "sales": 5600,  "returns": 1100},
            {"month": "Apr", "sales": 7200,  "returns": 1600},
            {"month": "May", "sales": 6100,  "returns": 1300},
            {"month": "Jun", "sales": 7800,  "returns": 1700},
        ],
        "east": [
            {"month": "Jan", "sales": 8200,  "returns": 400},
            {"month": "Feb", "sales": 10600, "returns": 500},
            {"month": "Mar", "sales": 9800,  "returns": 450},
            {"month": "Apr", "sales": 11800, "returns": 550},
            {"month": "May", "sales": 12400, "returns": 500},
            {"month": "Jun", "sales": 14200, "returns": 600},
        ],
        "west": [
            {"month": "Jan", "sales": 6000,  "returns": 800},
            {"month": "Feb", "sales": 6000,  "returns": 1000},
            {"month": "Mar", "sales": 5600,  "returns": 1000},
            {"month": "Apr", "sales": 5000,  "returns": 950},
            {"month": "May", "sales": 6000,  "returns": 1050},
            {"month": "Jun", "sales": 2000,  "returns": 800},
        ],
    }

    categories = {
        "all":   [{"category": "Electronics", "score": 82}, {"category": "Clothing", "score": 75}, {"category": "Home", "score": 80}, {"category": "Books", "score": 65}, {"category": "Sports", "score": 70}],
        "north": [{"category": "Electronics", "score": 98}, {"category": "Clothing", "score": 40}, {"category": "Home", "score": 92}, {"category": "Books", "score": 35}, {"category": "Sports", "score": 45}],
        "south": [{"category": "Electronics", "score": 45}, {"category": "Clothing", "score": 95}, {"category": "Home", "score": 50}, {"category": "Books", "score": 90}, {"category": "Sports", "score": 88}],
        "east":  [{"category": "Electronics", "score": 95}, {"category": "Clothing", "score": 60}, {"category": "Home", "score": 90}, {"category": "Books", "score": 55}, {"category": "Sports", "score": 40}],
        "west":  [{"category": "Electronics", "score": 50}, {"category": "Clothing", "score": 88}, {"category": "Home", "score": 55}, {"category": "Books", "score": 82}, {"category": "Sports", "score": 92}],
    }

    trend = {
        "all":   [{"month": "Mar", "revenue": 32000}, {"month": "Apr", "revenue": 35000}, {"month": "May", "revenue": 33500}, {"month": "Jun", "revenue": 38000}, {"month": "Jul", "revenue": 41000}, {"month": "Aug", "revenue": 39500}, {"month": "Sep", "revenue": 43000}, {"month": "Oct", "revenue": 45500}, {"month": "Nov", "revenue": 48000}, {"month": "Dec", "revenue": 52000}, {"month": "Jan", "revenue": 49000}, {"month": "Feb", "revenue": 54000}],
        "north": [{"month": "Mar", "revenue": 18000}, {"month": "Apr", "revenue": 20500}, {"month": "May", "revenue": 19000}, {"month": "Jun", "revenue": 22000}, {"month": "Jul", "revenue": 24500}, {"month": "Aug", "revenue": 23000}, {"month": "Sep", "revenue": 26000}, {"month": "Oct", "revenue": 28000}, {"month": "Nov", "revenue": 30000}, {"month": "Dec", "revenue": 35000}, {"month": "Jan", "revenue": 32000}, {"month": "Feb", "revenue": 38000}],
        "south": [{"month": "Mar", "revenue": 4200},  {"month": "Apr", "revenue": 4800},  {"month": "May", "revenue": 5100},  {"month": "Jun", "revenue": 5500},  {"month": "Jul", "revenue": 5200},  {"month": "Aug", "revenue": 5800},  {"month": "Sep", "revenue": 5500},  {"month": "Oct", "revenue": 6000},  {"month": "Nov", "revenue": 5800},  {"month": "Dec", "revenue": 6200},  {"month": "Jan", "revenue": 6000},  {"month": "Feb", "revenue": 6500}],
        "east":  [{"month": "Mar", "revenue": 5500},  {"month": "Apr", "revenue": 6200},  {"month": "May", "revenue": 7000},  {"month": "Jun", "revenue": 7800},  {"month": "Jul", "revenue": 8800},  {"month": "Aug", "revenue": 9500},  {"month": "Sep", "revenue": 10500}, {"month": "Oct", "revenue": 11500}, {"month": "Nov", "revenue": 12800}, {"month": "Dec", "revenue": 14000}, {"month": "Jan", "revenue": 15500}, {"month": "Feb", "revenue": 17000}],
        "west":  [{"month": "Mar", "revenue": 8500},  {"month": "Apr", "revenue": 8200},  {"month": "May", "revenue": 7800},  {"month": "Jun", "revenue": 7200},  {"month": "Jul", "revenue": 6800},  {"month": "Aug", "revenue": 6500},  {"month": "Sep", "revenue": 6000},  {"month": "Oct", "revenue": 5500},  {"month": "Nov", "revenue": 5200},  {"month": "Dec", "revenue": 4800},  {"month": "Jan", "revenue": 4200},  {"month": "Feb", "revenue": 3500}],
    }

    # Flatten the nested dicts into individual state keys (metrics_north,
    # monthly_south, ...) so the ternary chain can resolve them.
    state = {"region": "all"}
    for prefix, data in (
        ("metrics", metrics),
        ("monthly", monthly),
        ("categories", categories),
        ("trend", trend),
    ):
        for region in REGIONS:
            state[f"{prefix}_{region}"] = data[region]


    # Helper: build a ternary expression that picks the right dataset by region
    def pick(prefix):
        return (
            f"{{{{ region == 'north' ? {prefix}_north"
            f" : region == 'south' ? {prefix}_south"
            f" : region == 'east' ? {prefix}_east"
            f" : region == 'west' ? {prefix}_west"
            f" : {prefix}_all }}}}"
        )


    # A `let` on the Dashboard computes intermediate values once.
    # Everything inside references `m`, `chart`, `cat`, `t` instead
    # of repeating the ternary chain for every prop.
    with PrefabApp(state=state, css_class="max-w-none p-0"):
        with Dashboard(
            columns=12,
            row_height="auto",
            gap=4,
            let={
                "m": pick("metrics"),
                "chart": pick("monthly"),
                "cat": pick("categories"),
                "t": pick("trend"),
            },
        ):
            # Row 1: Region filter
            with DashboardItem(col=1, row=1, col_span=12):
                with Card():
                    with CardContent():
                        with Row(align="center", gap=4):
                            Muted("Region")
                            with Select(name="region", css_class="w-48"):
                                SelectOption(value="all", label="All Regions")
                                SelectOption(value="north", label="North")
                                SelectOption(value="south", label="South")
                                SelectOption(value="east", label="East")
                                SelectOption(value="west", label="West")

            # Row 2: Metrics — all driven by `m` from the let binding
            m = Rx("m")
            with DashboardItem(col=1, row=2, col_span=3):
                Metric(label="Revenue", value=m.revenue.currency())
            with DashboardItem(col=4, row=2, col_span=3):
                Metric(label="Units Sold", value=m.units.number())
            with DashboardItem(col=7, row=2, col_span=3):
                Metric(label="Avg Price", value=m.avg_price.currency())
            with DashboardItem(col=10, row=2, col_span=3):
                Metric(label="Stores", value=m.stores)

            # Row 3: Bar chart + radar chart
            chart = Rx("chart")
            cat = Rx("cat")
            t = Rx("t")
            with DashboardItem(col=1, row=3, col_span=7):
                with Card(css_class="h-full"):
                    with CardHeader():
                        CardTitle("Monthly Sales")
                    with CardContent():
                        BarChart(
                            data=chart,
                            series=[
                                ChartSeries(data_key="sales", label="Sales", color="#2563eb"),
                                ChartSeries(data_key="returns", label="Returns", color="#e76e50"),
                            ],
                            x_axis="month",
                            stacked=True,
                            bar_radius=0,
                            show_legend=True,
                            height=250,
                        )

            with DashboardItem(col=8, row=3, col_span=5):
                with Card(css_class="h-full"):
                    with CardHeader():
                        CardTitle("Category Performance")
                    with CardContent():
                        RadarChart(
                            data=cat,
                            series=[ChartSeries(data_key="score", label="Score")],
                            axis_key="category",
                            show_dots=True,
                            height=250,
                        )

            # Row 4: 12-month trend
            with DashboardItem(col=1, row=4, col_span=12):
                with Card():
                    with CardHeader():
                        CardTitle("Revenue Trend (12 months)")
                    with CardContent():
                        LineChart(
                            data=t,
                            series=[ChartSeries(data_key="revenue", label="Revenue", color="#2563eb")],
                            x_axis="month",
                            curve="smooth",
                            show_dots=True,
                            height=200,
                        )
    ```

    ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
    {
      "view": {
        "cssClass": "pf-app-root max-w-none p-0",
        "type": "Div",
        "children": [
          {
            "cssClass": "gap-4",
            "let": {
              "m": "{{ region == 'north' ? metrics_north : region == 'south' ? metrics_south : region == 'east' ? metrics_east : region == 'west' ? metrics_west : metrics_all }}",
              "chart": "{{ region == 'north' ? monthly_north : region == 'south' ? monthly_south : region == 'east' ? monthly_east : region == 'west' ? monthly_west : monthly_all }}",
              "cat": "{{ region == 'north' ? categories_north : region == 'south' ? categories_south : region == 'east' ? categories_east : region == 'west' ? categories_west : categories_all }}",
              "t": "{{ region == 'north' ? trend_north : region == 'south' ? trend_south : region == 'east' ? trend_east : region == 'west' ? trend_west : trend_all }}"
            },
            "type": "Dashboard",
            "columns": 12,
            "rowHeight": "auto",
            "children": [
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 1,
                "colSpan": 12,
                "rowSpan": 1,
                "children": [
                  {
                    "type": "Card",
                    "children": [
                      {
                        "type": "CardContent",
                        "children": [
                          {
                            "cssClass": "gap-4 items-center",
                            "type": "Row",
                            "children": [
                              {"content": "Region", "type": "Muted"},
                              {
                                "cssClass": "w-48",
                                "name": "region",
                                "type": "Select",
                                "size": "default",
                                "disabled": false,
                                "required": false,
                                "invalid": false,
                                "children": [
                                  {
                                    "type": "SelectOption",
                                    "value": "all",
                                    "label": "All Regions",
                                    "selected": false,
                                    "disabled": false
                                  },
                                  {
                                    "type": "SelectOption",
                                    "value": "north",
                                    "label": "North",
                                    "selected": false,
                                    "disabled": false
                                  },
                                  {
                                    "type": "SelectOption",
                                    "value": "south",
                                    "label": "South",
                                    "selected": false,
                                    "disabled": false
                                  },
                                  {
                                    "type": "SelectOption",
                                    "value": "east",
                                    "label": "East",
                                    "selected": false,
                                    "disabled": false
                                  },
                                  {
                                    "type": "SelectOption",
                                    "value": "west",
                                    "label": "West",
                                    "selected": false,
                                    "disabled": false
                                  }
                                ]
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 2,
                "colSpan": 3,
                "rowSpan": 1,
                "children": [{"type": "Metric", "label": "Revenue", "value": "{{ m.revenue | currency }}"}]
              },
              {
                "type": "DashboardItem",
                "col": 4,
                "row": 2,
                "colSpan": 3,
                "rowSpan": 1,
                "children": [{"type": "Metric", "label": "Units Sold", "value": "{{ m.units | number }}"}]
              },
              {
                "type": "DashboardItem",
                "col": 7,
                "row": 2,
                "colSpan": 3,
                "rowSpan": 1,
                "children": [
                  {
                    "type": "Metric",
                    "label": "Avg Price",
                    "value": "{{ m.avg_price | currency }}"
                  }
                ]
              },
              {
                "type": "DashboardItem",
                "col": 10,
                "row": 2,
                "colSpan": 3,
                "rowSpan": 1,
                "children": [{"type": "Metric", "label": "Stores", "value": "{{ m.stores }}"}]
              },
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 3,
                "colSpan": 7,
                "rowSpan": 1,
                "children": [
                  {
                    "cssClass": "h-full",
                    "type": "Card",
                    "children": [
                      {
                        "type": "CardHeader",
                        "children": [{"type": "CardTitle", "content": "Monthly Sales"}]
                      },
                      {
                        "type": "CardContent",
                        "children": [
                          {
                            "type": "BarChart",
                            "data": "{{ chart }}",
                            "series": [
                              {"dataKey": "sales", "label": "Sales", "color": "#2563eb"},
                              {"dataKey": "returns", "label": "Returns", "color": "#e76e50"}
                            ],
                            "xAxis": "month",
                            "height": 250,
                            "stacked": true,
                            "horizontal": false,
                            "barRadius": 0,
                            "showLegend": true,
                            "showTooltip": true,
                            "animate": true,
                            "showGrid": true,
                            "showYAxis": true,
                            "valueFormat": "auto"
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "type": "DashboardItem",
                "col": 8,
                "row": 3,
                "colSpan": 5,
                "rowSpan": 1,
                "children": [
                  {
                    "cssClass": "h-full",
                    "type": "Card",
                    "children": [
                      {
                        "type": "CardHeader",
                        "children": [{"type": "CardTitle", "content": "Category Performance"}]
                      },
                      {
                        "type": "CardContent",
                        "children": [
                          {
                            "type": "RadarChart",
                            "data": "{{ cat }}",
                            "series": [{"dataKey": "score", "label": "Score"}],
                            "axisKey": "category",
                            "height": 250,
                            "filled": true,
                            "showDots": true,
                            "showLegend": true,
                            "showTooltip": true,
                            "animate": true,
                            "showGrid": true
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "type": "DashboardItem",
                "col": 1,
                "row": 4,
                "colSpan": 12,
                "rowSpan": 1,
                "children": [
                  {
                    "type": "Card",
                    "children": [
                      {
                        "type": "CardHeader",
                        "children": [{"type": "CardTitle", "content": "Revenue Trend (12 months)"}]
                      },
                      {
                        "type": "CardContent",
                        "children": [
                          {
                            "type": "LineChart",
                            "data": "{{ t }}",
                            "series": [{"dataKey": "revenue", "label": "Revenue", "color": "#2563eb"}],
                            "xAxis": "month",
                            "height": 200,
                            "curve": "smooth",
                            "showDots": true,
                            "showLegend": true,
                            "showTooltip": true,
                            "animate": true,
                            "showGrid": true,
                            "showYAxis": true,
                            "valueFormat": "auto"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "state": {
        "region": "all",
        "metrics_all": {"revenue": 284750, "units": 12450, "avg_price": 22.87, "stores": 48},
        "metrics_north": {"revenue": 142800, "units": 4200, "avg_price": 34.0, "stores": 8},
        "metrics_south": {"revenue": 38900, "units": 3850, "avg_price": 10.1, "stores": 18},
        "metrics_east": {"revenue": 67200, "units": 1680, "avg_price": 40.0, "stores": 6},
        "metrics_west": {"revenue": 35850, "units": 2720, "avg_price": 13.18, "stores": 16},
        "monthly_all": [
          {"month": "Jan", "sales": 42000, "returns": 3200},
          {"month": "Feb", "sales": 48500, "returns": 3800},
          {"month": "Mar", "sales": 45200, "returns": 3400},
          {"month": "Apr", "sales": 51800, "returns": 4100},
          {"month": "May", "sales": 47600, "returns": 3600},
          {"month": "Jun", "sales": 53200, "returns": 4200}
        ],
        "monthly_north": [
          {"month": "Jan", "sales": 22000, "returns": 800},
          {"month": "Feb", "sales": 25500, "returns": 900},
          {"month": "Mar", "sales": 24200, "returns": 850},
          {"month": "Apr", "sales": 27800, "returns": 1000},
          {"month": "May", "sales": 23100, "returns": 750},
          {"month": "Jun", "sales": 29200, "returns": 1100}
        ],
        "monthly_south": [
          {"month": "Jan", "sales": 5800, "returns": 1200},
          {"month": "Feb", "sales": 6400, "returns": 1400},
          {"month": "Mar", "sales": 5600, "returns": 1100},
          {"month": "Apr", "sales": 7200, "returns": 1600},
          {"month": "May", "sales": 6100, "returns": 1300},
          {"month": "Jun", "sales": 7800, "returns": 1700}
        ],
        "monthly_east": [
          {"month": "Jan", "sales": 8200, "returns": 400},
          {"month": "Feb", "sales": 10600, "returns": 500},
          {"month": "Mar", "sales": 9800, "returns": 450},
          {"month": "Apr", "sales": 11800, "returns": 550},
          {"month": "May", "sales": 12400, "returns": 500},
          {"month": "Jun", "sales": 14200, "returns": 600}
        ],
        "monthly_west": [
          {"month": "Jan", "sales": 6000, "returns": 800},
          {"month": "Feb", "sales": 6000, "returns": 1000},
          {"month": "Mar", "sales": 5600, "returns": 1000},
          {"month": "Apr", "sales": 5000, "returns": 950},
          {"month": "May", "sales": 6000, "returns": 1050},
          {"month": "Jun", "sales": 2000, "returns": 800}
        ],
        "categories_all": [
          {"category": "Electronics", "score": 82},
          {"category": "Clothing", "score": 75},
          {"category": "Home", "score": 80},
          {"category": "Books", "score": 65},
          {"category": "Sports", "score": 70}
        ],
        "categories_north": [
          {"category": "Electronics", "score": 98},
          {"category": "Clothing", "score": 40},
          {"category": "Home", "score": 92},
          {"category": "Books", "score": 35},
          {"category": "Sports", "score": 45}
        ],
        "categories_south": [
          {"category": "Electronics", "score": 45},
          {"category": "Clothing", "score": 95},
          {"category": "Home", "score": 50},
          {"category": "Books", "score": 90},
          {"category": "Sports", "score": 88}
        ],
        "categories_east": [
          {"category": "Electronics", "score": 95},
          {"category": "Clothing", "score": 60},
          {"category": "Home", "score": 90},
          {"category": "Books", "score": 55},
          {"category": "Sports", "score": 40}
        ],
        "categories_west": [
          {"category": "Electronics", "score": 50},
          {"category": "Clothing", "score": 88},
          {"category": "Home", "score": 55},
          {"category": "Books", "score": 82},
          {"category": "Sports", "score": 92}
        ],
        "trend_all": [
          {"month": "Mar", "revenue": 32000},
          {"month": "Apr", "revenue": 35000},
          {"month": "May", "revenue": 33500},
          {"month": "Jun", "revenue": 38000},
          {"month": "Jul", "revenue": 41000},
          {"month": "Aug", "revenue": 39500},
          {"month": "Sep", "revenue": 43000},
          {"month": "Oct", "revenue": 45500},
          {"month": "Nov", "revenue": 48000},
          {"month": "Dec", "revenue": 52000},
          {"month": "Jan", "revenue": 49000},
          {"month": "Feb", "revenue": 54000}
        ],
        "trend_north": [
          {"month": "Mar", "revenue": 18000},
          {"month": "Apr", "revenue": 20500},
          {"month": "May", "revenue": 19000},
          {"month": "Jun", "revenue": 22000},
          {"month": "Jul", "revenue": 24500},
          {"month": "Aug", "revenue": 23000},
          {"month": "Sep", "revenue": 26000},
          {"month": "Oct", "revenue": 28000},
          {"month": "Nov", "revenue": 30000},
          {"month": "Dec", "revenue": 35000},
          {"month": "Jan", "revenue": 32000},
          {"month": "Feb", "revenue": 38000}
        ],
        "trend_south": [
          {"month": "Mar", "revenue": 4200},
          {"month": "Apr", "revenue": 4800},
          {"month": "May", "revenue": 5100},
          {"month": "Jun", "revenue": 5500},
          {"month": "Jul", "revenue": 5200},
          {"month": "Aug", "revenue": 5800},
          {"month": "Sep", "revenue": 5500},
          {"month": "Oct", "revenue": 6000},
          {"month": "Nov", "revenue": 5800},
          {"month": "Dec", "revenue": 6200},
          {"month": "Jan", "revenue": 6000},
          {"month": "Feb", "revenue": 6500}
        ],
        "trend_east": [
          {"month": "Mar", "revenue": 5500},
          {"month": "Apr", "revenue": 6200},
          {"month": "May", "revenue": 7000},
          {"month": "Jun", "revenue": 7800},
          {"month": "Jul", "revenue": 8800},
          {"month": "Aug", "revenue": 9500},
          {"month": "Sep", "revenue": 10500},
          {"month": "Oct", "revenue": 11500},
          {"month": "Nov", "revenue": 12800},
          {"month": "Dec", "revenue": 14000},
          {"month": "Jan", "revenue": 15500},
          {"month": "Feb", "revenue": 17000}
        ],
        "trend_west": [
          {"month": "Mar", "revenue": 8500},
          {"month": "Apr", "revenue": 8200},
          {"month": "May", "revenue": 7800},
          {"month": "Jun", "revenue": 7200},
          {"month": "Jul", "revenue": 6800},
          {"month": "Aug", "revenue": 6500},
          {"month": "Sep", "revenue": 6000},
          {"month": "Oct", "revenue": 5500},
          {"month": "Nov", "revenue": 5200},
          {"month": "Dec", "revenue": 4800},
          {"month": "Jan", "revenue": 4200},
          {"month": "Feb", "revenue": 3500}
        ]
      }
    }
    ```
  </CodeGroup>
</ComponentPreview>

## How It Works

The key technique is **pre-segmenting data by filter value and using ternary expressions to select the active dataset.** All five variants of the data (one per region, plus "all") live in state from the start. When the user picks a region, the renderer re-evaluates every expression that references `region` and swaps in the matching data — no network call, no script rerun.

### The `let` binding pattern

Rather than repeating the ternary expression in every metric and chart prop, a `let` binding on the [Dashboard](/docs/components/dashboard-grid) computes four intermediate values once:

```python theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
with Dashboard(
    columns=12,
    row_height="auto",
    gap=4,
    let={
        "m": pick("metrics"),       # resolves to the active metrics dict
        "chart": pick("monthly"),   # resolves to the active monthly data
        "cat": pick("categories"),  # resolves to the active category scores
        "t": pick("trend"),         # resolves to the active trend data
    },
):
```

Everything inside the Dashboard can reference `{{ m.revenue }}` or `data="{{ chart }}"` directly. The `pick()` helper builds the ternary chain: `{{ region == 'north' ? metrics_north : region == 'south' ? metrics_south : ... : metrics_all }}`.

### How the Select drives state

The [Select](/docs/components/select) component uses `name="region"` to auto-bind its value to `state.region`. When the user picks "North", the renderer sets `region = "north"`, which triggers the `let` binding to re-evaluate, which swaps every metric value, chart dataset, and radar shape simultaneously.

### Expression pipes for formatting

The [Metric](/docs/components/metric) values use pipes to format raw numbers from state:

* `{{ m.revenue | currency }}` renders as "\$284,750"
* `{{ m.units | number }}` renders as "12,450" with locale separators
* `{{ m.avg_price | currency }}` renders as "\$22.87"

These are live expressions — when the region changes, the formatted output updates with the new values.
