--- name: canvas-templates description: How PostHog "canvas" dashboards work end-to-end — the two rendering tiers (json-render vs freeform React-in-iframe), the agent system prompts that steer each, and the RIGHT way to fetch PostHog data (typed query nodes through ph.query, not hand-rolled HogQL). Use when changing canvas templates, the freeform sandbox, the ph.* data shim, canvas data fetching, or the agent prompts that build dashboards / web-analytics boards. --- # Canvas templates & data PostHog "canvases" are agent-built dashboards/apps. There are **two rendering tiers** and a strict **data path**. Get the tier and the data path right and most canvas work is straightforward; get them wrong and you ship correctness bugs. ## The two tiers A canvas's `kind` (set at create time, persisted in file meta) decides everything: | Tier | `kind` | What the agent writes | Renderer | Data path | | --- | --- | --- | --- | --- | | **json-render** | `"json-render"` | JSONL patches against a component catalog | `ViewRenderer` (Quill component tree) | `state.queries` HogQL, re-run by `dashboardsService` on refresh | | **freeform / React** | `"freeform"` | a single-file React app | sandboxed `