---
title: The canvas
description: Each file's canvas is a grid of live views. Steps run left to right, and states and alternatives sit in rows below.
---

A file's canvas shows every view of the file as a live page. This page covers how the grid works, where the controls are, how to arrange frames, and the format of `canvas.json`.

## How the grid works

A canvas holds sections, one under another. Each section is a grid:

- **Columns** are steps, left to right
- **Rows** are paths through the section: the main path first, then states and alternatives, such as a declined card or a mobile layout
- **A row that changes one step** needs only one frame, under that step. Play fills in the other steps from the main row.

Hover over a section's name for **Play**, to present it.

A new file's canvas starts empty. Press **F** and drag to draw a frame, or click for a desktop-sized one. A comment opens on the new frame: say what it should become, and your agent builds it.

## Specs and documents

A spec is a markdown page on the canvas that agents follow. Press **D**, then click to place one:

- **In a section**: it's that section's spec, for work in that section
- **Anywhere else**: it's part of the file spec, for the whole file

Agents read a file's specs left to right, top to bottom. Click a spec to write in it, or choose **⤢** beside its name to open it full screen. Each spec is a markdown file in `people/<you>/specs/`. A removed spec stays in the file's archive: choose **View archive** from the file's menu to put it back.

Documents, such as critiques, briefs and handoff notes in `docs/`, work the same way. Anyone on the team can edit them and comment on them.

## Where the controls are

The controls float over the canvas in small groups. A panel opens under the group it comes from. Press Escape to close it.

- **Top left**: **Home** and the file's name. Click the name to rename the file. The menu beside it has the archive, **Duplicate** and **Delete…**.
- **Top right**: **Comments**, **Play**, and [**Sync**](/docs/branches-and-pull-requests), or with pull requests your branch's next step
- **Bottom**: the toolbar, with the tools, **Add**, the zoom and the theme. Hover a control for its name and key.
- **Bottom right**: the agent bar. It says what your agent is doing, and its button is the next step: connect an agent, open it, pause or resume. Drag it to any corner.

A lock beside the file's name means you can't edit the canvas here. Hover it to see why.

Press ⌘ \ to hide everything but the file's name, and again to bring it back.

## Arrange frames

- **Drag** frames between cells, where they snap into place. Frames and sections snap to each other's edges, with a guide. Hold ⌘ to place freely.
- **Hold ⌥ as you drop** to leave a copy.
- **Copy and paste** frames with ⌘ C and ⌘ V, or duplicate them with ⌘ D. Copies go just after the originals.
- **Click a name** to rename a section or frame.
- **Click +** beside a selected frame to add a view after it, or to ask an agent for a new one.
- **Press Shift S** and drag to draw a section. Frames inside the area join it. To group frames you've selected, right-click them and choose **New section from these**.
- **Drag a section by its name** to reorder it. Drag its right edge, bottom edge or corner to resize it, and double-click the edge to fit it to its frames.
- **Right-click frames** for **Copy as PNG**, **Download PNG** and **Remove from the canvas**. PNGs need Playwright's Chromium: run `npx playwright install chromium`.
- **Select a frame** to set its size from the bar under it: a device, or a width and height of its own.

A teammate's sections and frames stay theirs. Comment on them, or change a frame to make your own copy.

Changes save to `canvas.json` straight away, with undo. Agents' edits appear as they save.

## Keyboard shortcuts

| Keys | Does |
| --- | --- |
| V, H, C | Select, hand, comment |
| W, T, I | Wireframe, edit text, inspect styles |
| X | X-ray: outline every element |
| F, Shift S | Draw a frame, draw a section |
| D, Shift D | Place a spec, place a slide |
| Shift A | Components |
| Shift G | Show or hide the grid |
| Shift 1, Shift 2, Shift 0 | Fit all, fit selection, 100% |
| ⌘ +, ⌘ −, ⌘ 0 | Zoom in, zoom out, 100% |
| ⌘ C, ⌘ X, ⌘ V, ⌘ D | Copy, cut, paste, duplicate |
| Enter | Use the selected frame as a live page |
| Shift Enter | Select the frames' section |
| ⌥ ⌘ Enter | Play from the selected frame |
| Space and drag | Pan |
| ⌘ Z, Shift ⌘ Z | Undo, redo |
| Delete | Remove the selection |
| Escape | Step back or deselect |

## The canvas.json format

Dex writes `canvas.json` for you. Agents and scripts can edit it too:

```json
{
	"sections": [
		{
			"id": "checkout",
			"title": "Checkout",
			"rows": [
				{
					"id": "main",
					"frames": [
						{ "id": "cart", "view": "cart", "viewport": "mobile" },
						{ "id": "pay", "view": "pay" }
					]
				},
				{
					"id": "declined",
					"frames": [
						{ "id": "pay", "view": "pay", "step": 2, "params": { "state": "declined" } }
					]
				}
			]
		}
	]
}
```

| Field | Meaning |
| --- | --- |
| `id`, `title` | On sections and frames. Frame ids are unique in their row. |
| `description` | One line about a section. |
| `view` or `doc` | One of the two: a view from `views/` or a document from `docs/`. |
| `step` | The column, from 1. Leave it out to follow the previous frame. |
| `viewport` | `desktop` (1280×800, default), `tablet` (768×1024) or `mobile` (375×812). |
| `size` | `{ "width", "height" }`, in place of the viewport's size. |
| `params` | The view's query string. |

`npx dex check` validates canvases, and `dex build` fails until they pass.
