# Containers and icons (D2) Beyond nesting, D2 has a small styling vocabulary that is enough to make a diagram look deliberate without a stylesheet. --- ## What this example shows * Named containers with display labels. * Shape keywords, which change how a node is drawn. * Per-node style blocks for fill and stroke. --- ## A worked example Open it, edit it, or copy the source below. ![Containers and icons (D2)](https://help.gocapable.com/images/att1423704088.svg) The source, which you can paste into a new diagram and edit: ``` direction: down team: Platform team { style: { fill: "#f8fafc" stroke: "#94a3b8" } build: Build pipeline { shape: hexagon } registry: Image registry { shape: cylinder } deploy: Deployer { shape: hexagon } } clusters: Environments { staging: Staging { shape: package } prod: Production { shape: package style: { stroke: "#b91c1c" stroke-width: 2 } } } team.build -> team.registry: push image team.registry -> team.deploy: pull team.deploy -> clusters.staging: deploy clusters.staging -> clusters.prod: promote { style.stroke-dash: 4 } ``` --- ## Making it your own * Shapes worth knowing: cylinder, hexagon, package, queue, document, person. * Style blocks nest, so a container style applies as a background to its children. * stroke-dash on a connection is the tidy way to mark something conditional. --- ## Related [Sequence diagram (D2)D2's own sequence syntax.](https://help.gocapable.com/diagrams/sequence-diagram-d2.html) [UML class diagram (D2)Classes with typed members.](https://help.gocapable.com/diagrams/uml-class-diagram-d2.html) [D2 examplesBack to the rest of these examples.](https://help.gocapable.com/diagrams/d2-examples.html) --- _Nesting is the whole idea._