Nodes

A page's nodes hold its icons, groups, text, shapes and images, in drawing order: later nodes are drawn on top.

Common fields#

FieldValueNotes
idstringUnique among the page's nodes.
type"icon", "group", "text", "shape" or "image"Optional. Defaults to "icon".
position{ "x": 0, "y": 0 }The top-left corner, in world units.
size{ "width": 64, "height": 64 }Required for groups and images, optional for the rest.
labelstringOptional. Lines are separated by \n.
styleobjectOptional. See Styles.
costobjectOptional. See Cost settings.

Label lines that start with - or * are a bulleted list, and lines that start with a number and . or ) a numbered list. Group labels stay on one line. See Lists.

Icon nodes#

{
  "id": "fn",
  "icon": "AWS-Lambda",
  "position": { "x": 0, "y": 0 },
  "label": "Orders handler"
}

icon is an icon name:

SetNamesExample
AWSAs in the AWS icon setAWS-Lambda, Amazon-DynamoDB
Google CloudStart with GCP_GCP_BigQuery
AzureStart with Azure_Azure_Virtual-Machine
GenericStart with Generic_Generic_Router, Generic_Laptop

Find a name with MCP's search_icons, or by adding the icon in the editor and reading it in the code panel. Icon nodes are always square, the larger of width and height, and 64 × 64 without a size. The label goes under the icon, so leave room below.

Groups#

{
  "id": "vpc",
  "type": "group",
  "icon": "Virtual-private-cloud-VPC",
  "position": { "x": 0, "y": 0 },
  "size": { "width": 480, "height": 320 },
  "label": "VPC"
}

The icon is a group icon, such as AWS-Cloud, AWS-Account, Region, Virtual-private-cloud-VPC, Public-subnet, Private-subnet or Auto-Scaling-group, or a generic one such as Generic_Data-center-group.

Groups have no list of children. Every node that lies fully inside a group's rectangle belongs to it, so give groups a size and keep their children completely inside.

Leave 64 units between a group's sides and the icons inside, 72 at the top for its icon and label, and 64 below the lowest icon for that icon's label.

Frames#

{
  "id": "loop1",
  "type": "group",
  "frame": "tab",
  "position": { "x": 0, "y": 0 },
  "size": { "width": 480, "height": 240 },
  "label": "loop"
}

A frame is a group without an icon, for UML diagrams. Leave out icon and set frame:

frameLooks likeUsed for
"plain"A rectangle with its label in the top-left cornerSystem boundaries, swimlanes
"rounded"A rectangle with rounded cornersComposite states
"tab"A rectangle with its label in a tabCombined fragments such as loop

Frames contain the nodes inside them like any group. The label takes the top 28 units.

Text nodes#

{
  "id": "note",
  "type": "text",
  "position": { "x": 0, "y": 0 },
  "label": "Traffic is served from two regions"
}

Free text without an icon or outline, 160 × 32 without a size.

Shapes#

{
  "id": "step",
  "type": "shape",
  "shape": "diamond",
  "position": { "x": 0, "y": 0 },
  "label": "In stock?"
}

For process steps, decisions, actors, notes and UML elements. shape is required and is one of:

rectangle
rounded-rectangle
circle
triangle
diamond
pentagon
hexagon
octagon
star
parallelogram
cylinder
sticky-note
actor
lifeline
actor-lifeline
filled-circle
bullseye
crossed-circle
ring
bar
cross
divider
send-signal
accept-event
hourglass
  • The label is centered inside and wrapped to fit. Text that doesn't fit runs outside, so size the shape for its text.
  • Without a size, a shape gets the size the editor inserts it with. Shapes resize freely and don't contain other nodes.
  • A sticky-note has a grey border and no fill unless styled. For the editor's look, set "style": { "fill": "yellow", "border": { "color": "transparent" } }. Its text fills the note, from 6 to 32, unless its text style sets a size.

UML shapes#

The shapes from actor on are for UML diagrams:

  • actor, filled-circle, bullseye, crossed-circle, ring, bar, cross and hourglass put their label under the shape. filled-circle and bar are filled with the line color, so they follow the theme.
  • send-signal points right and accept-event has a notch on its left. Their label stays clear of both.
  • A lifeline is a box 40 units tall with a dashed line down to the bottom of its size, and an actor-lifeline has a stick figure in its top 80 units instead. Arrows attached to a lifeline's left or right side below its head end on the dashed line, so a message between two lifelines is an arrow with the same offset at both ends.
  • A divider is a line along its top edge with its label under it, for fragment operands and state regions. The editor inserts it with "style": { "border": { "dash": "dashed" }, "text": { "align": "left" } }.

Image nodes#

{
  "id": "shot",
  "type": "image",
  "image": "<image id>",
  "position": { "x": 0, "y": 0 },
  "size": { "width": 320, "height": 180 },
  "label": "Optional caption"
}

image is the 24-character id of a picture uploaded in the editor, and size is required, with both sides above 0. Image nodes have no icon, and the label is a caption under the picture.

Image nodes can't be created from JSON alone, since their ids come from uploads in the editor. See Adding images. The picture stretches to fill size, so keep its proportions when you resize it.