Skip to content

Layout

How a diagram is laid out is part of the diagram itself, so everyone who opens it (in the editor or through a shared link) sees the same thing.

One optional line, at the top level of the diagram:

layout direction=right spacing=40
node id="api" title="API"
node id="db" title="Postgres" shape="cylinder"
edge from="api" to="db"
Setting Values Default What it does
direction auto, down, right, up, left auto Which way connections flow. auto tries top-down and left-to-right (folding very long chains into rows when that helps) and keeps whichever fits the canvas best.
spacing 0–200 20 Space between nodes.
padding 20–80 30 Space inside groups.

Every setting is optional; anything you leave out uses the default, and a diagram with all defaults has no layout line at all.

You rarely need to type it: the Layout menu on the canvas writes this line for you, and Reset layout to defaults removes it.

Typos are reported like any other error, for example layout direction must be one of auto, down, right, up, left. Only the first layout line is used, and it can’t be placed inside a group.

Dragging a node on the canvas pins it where you dropped it by writing x= and y= on that node:

node id="api" title="API" x=420 y=180

Positions are relative to the node’s group (or to the canvas at the top level), so a pinned node moves with its group. Nodes without a position keep being laid out automatically.

Auto-arrange in the Layout menu (or ⌘K) removes every x=/y=, so the whole diagram is laid out automatically again.

Zooming, collapsing groups, showing all edge labels, previewing groups on hover and light/dark appearance only change what you see. They are never written to the diagram.