Nodes
A page's nodes hold its icons, groups, text, shapes and images, in drawing order: later nodes are drawn on top.
Common fields#
| Field | Value | Notes |
|---|---|---|
id | string | Unique 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. |
label | string | Optional. Lines are separated by \n. |
style | object | Optional. See Styles. |
cost | object | Optional. 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:
| Set | Names | Example |
|---|---|---|
| AWS | As in the AWS icon set | AWS-Lambda, Amazon-DynamoDB |
| Google Cloud | Start with GCP_ | GCP_BigQuery |
| Azure | Start with Azure_ | Azure_Virtual-Machine |
| Generic | Start 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:
frame | Looks like | Used for |
|---|---|---|
"plain" | A rectangle with its label in the top-left corner | System boundaries, swimlanes |
"rounded" | A rectangle with rounded corners | Composite states |
"tab" | A rectangle with its label in a tab | Combined 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:
rectanglerounded-rectanglecircletrianglediamondpentagonhexagonoctagonstarparallelogramcylindersticky-noteactorlifelineactor-lifelinefilled-circlebullseyecrossed-circleringbarcrossdividersend-signalaccept-eventhourglass- 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-notehas 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 asize.
UML shapes#
The shapes from actor on are for UML diagrams:
actor,filled-circle,bullseye,crossed-circle,ring,bar,crossandhourglassput their label under the shape.filled-circleandbarare filled with the line color, so they follow the theme.send-signalpoints right andaccept-eventhas a notch on its left. Their label stays clear of both.- A
lifelineis a box 40 units tall with a dashed line down to the bottom of itssize, and anactor-lifelinehas a stick figure in its top 80 units instead. Arrows attached to a lifeline'sleftorrightside below its head end on the dashed line, so a message between two lifelines is an arrow with the sameoffsetat both ends. - A
divideris 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.