Icons
tip
We host a collection of icons commonly found in software architecture diagrams for free to help you get started: https://icons.terrastruct.com.
Icons and images are an essential part of production-ready diagrams.
You can use any URL as value.
Using the D2 CLI locally? You can specify local images like icon: ./my_cat.png
.
Icon placement is automatic. Considerations vary depending on layout engine, but things like coexistence with a label and whether it's a container generally affect where the icon is placed to not obstruct. Notice how the following diagram has container icons in the top-left and non-container icons in the center.
Icons can be positioned with the near
keyword introduced later.