clean Shapes¶
The clean library provides 21 flat technical-diagramming shapes. Each shape is a
D2 class applied with class: <name>. Differentiation is carried by tint
(paper for compute, actors, AI, and logic; slate for data; muted + dashed for
external systems) and by shape, with the single clay accent reserved for
emphasis (clean-primary).
Every diagram below renders in both light and dark to match the documentation theme.
Usage¶
import d2
code = """
client: Client { class: clean-client }
gw: API Gateway { class: clean-gateway }
api: Orders API { class: clean-primary }
db: Postgres { class: clean-database }
client -> gw { class: clean-flow }
gw -> api { class: clean-flow-primary }
api -> db { class: clean-flow }
"""
svg = d2.compile(code, library="clean")
Compute¶
Paper-tinted boxes for services and endpoints. clean-primary carries the
clay accent for the emphasized node; clean-gateway is a hexagon and
clean-cloud a cloud outline.
Class |
Use |
|---|---|
|
Generic service or component box. |
|
Emphasized or primary node, carrying the clay accent. |
|
API or endpoint. |
|
Gateway or ingress (hexagon). |
|
Function, lambda, or handler. |
|
Cloud or managed service (cloud shape). |
Data¶
Slate-tinted shapes for the data plane. clean-database and clean-storage
are cylinders; clean-cache and clean-queue are slate rectangles.
Class |
Use |
|---|---|
|
Relational or primary datastore (cylinder). |
|
Cache layer such as Redis or a CDN. |
|
Object or blob storage (cylinder). |
|
Message queue or stream. |
Actors¶
Clients and people. clean-user is a person silhouette; clean-external is
a muted, dashed box for third-party systems outside your control.
Class |
Use |
|---|---|
|
Generic client or consumer. |
|
Web client. |
|
Mobile client. |
|
End user (person shape). |
|
Third-party or external system (muted fill, dashed border). |
AI¶
Paper-tinted shapes for model-centric flows. clean-document is a page shape
for artifacts and inputs.
Class |
Use |
|---|---|
|
Model or inference endpoint. |
|
Agent. |
|
Document or artifact (page shape). |
Logic & Structure¶
Control-flow and grouping shapes. clean-decision is a diamond; clean-group
is a transparent container with a hairline boundary for grouping related nodes.
Class |
Use |
|---|---|
|
Branch or decision point (diamond). |
|
Process or step. |
|
Transparent grouping container with a hairline boundary. |
Flow Edges¶
Four edge classes set the emphasis of a connection. clean-flow-primary uses
the clay accent for the main path; clean-flow-muted and clean-flow-dashed
de-emphasize secondary, optional, or asynchronous links.
Class |
Use |
|---|---|
|
Standard connection. |
|
Clay-accented primary path. |
|
Low-emphasis or secondary link. |
|
Optional, asynchronous, or external link. |
Panels and Typography¶
Use clean-panel for the outer grouped surface and clean-band for a
slate-tinted sub-grouping such as a data plane. For text-only labels use
clean-title, clean-subtitle, clean-label, clean-section-label,
and clean-note.