Skip to main content

Connections

Connections define relationships between shapes.

Basics

They consist of two shape keys separated by at least one hyphen. They may have a source arrow, target arrow, or both.

If you reference an undeclared shape in a connection, it's implicitly created (as shown in the hello world example).

To define a label on a connection, just give it a string value, as you would adding labels on shapes.

If the line becomes too long, you can escape newlines with \.

note

Currently multiline connections will be autoformatted onto the same line. Soon, we'll update the autoformatter to handle wrapping automatically so you'll never need to manually wrap.

Connections must reference a shape's key, not their label.

Example

connections render

Repeated connections

Repeated connections will not override existing connections and instead declare new ones.

connections render

Chaining

You can also chain connection.

connections render

Cycles

Cycles are completely valid in D2.

connections render