Skip to main content

D2

D2 creates modern diagrams from declarations, connections, containers, and style properties.

Use this type​

Use D2 for architecture diagrams, dependency graphs, process diagrams, and annotated technical sketches.

Source format​

The source format is D2 text. Enter the source in the diagram.zip editor.

Syntax essentials​

  • Declare a shape with an identifier and an optional label.
  • Use an arrow to connect two shapes.
  • Put nested elements inside braces.
  • Put style properties below style.

Example​

user: User
agent: Agent
diagram: "diagram.zip"
user -> agent: request
agent -> diagram: create
Rendered exampleDrag to pan. Use the wheel or controls to zoom.
100%
This view uses the live diagram.zip renderer.

Upstream reference​

D2 documentation