Loading…
Loading…
Architecture is the default family: omit the header and you get a graph that flows left to right, ideal for systems, services, and data flow. It shares its grammar (nodes, groups, and edges) with flowcharts, BPMN, org charts, and state machines, so what you learn here carries across all of them.
Name [attrs] declares a node: the label is the name, the id is the slug.id = Name [attrs] declares an explicit id. Edges name the node by it, and so do
the steps of a flow added over the diagram (target: "api", an arrow as "api -> db").\n breaks the line: course = "Course Service\nCatalog · lessons"
draws the name over a short description."Base UI — menus, popovers, dialogs" is one node, unquoted it is three.An icon on its own draws as a glyph with the label beneath it; an icon combined with a shape or colour draws that shape, with the icon riding the corner as a badge. See attributes for the full styling vocabulary.
[sticky] nodes render as real sticky notes; every other shape is a drawn node
in the canvas style.
Optional key lines sit at the top level, anywhere.
| Directive | Values |
|---|---|
title: | The diagram title, drawn on the wrapper frame. |
direction: | right (default), down, left, up. |
icons: | inside (default) or badge, and/or a drawn style: cartoon, geometric, inkbrush, solid, blockprint, stick, drawn. |
colorMode: | pastel (default), bold, outline: the default fill for every node that sets none. |
arrows: | elbow, curved, straight: how every connector is drawn. Absent, the layout picks per edge. |
font-size: | A number from 10 to 40 (default 20): the size of the box labels; edge labels and group titles scale with it. |
spine: | A chain of node names joined by ->: laid on one straight row (one column for down), with the rest branching off it. |
fit: | A target width-to-height ratio such as 16:9, 4:3 or 1.5: a layout far off it wraps its rows (or, top-down, its columns) toward it. |
left and up lay out as right and down, then mirror the result. icons sets
where every node icon renders: inside rides the icon inline before the label,
badge hangs a small square off the shape's corner. A style word (icons: cartoon)
draws every plain icon in that hand of the drawn library.
Without arrows: the layout chooses for each edge: a straight line where the
two boxes line up, a right-angle elbow elsewhere, and a bow where no clear
route exists. arrows: elbow makes every edge a right-angle route, curved
draws every edge as a smooth bow, and straight as a direct line from box to
box. Each stays attached to its boxes when you move them. font-size: lays the
text out at that size and sizes every box around it, so nothing overflows.
A group wraps members in a container. Members are node declarations, or references to nodes declared elsewhere, separated by newlines or commas.
frame. A frame of browser, phone,
tablet, or window draws the container as device chrome instead of a tinted
box.[group: Name].A board often holds an overview and the detail behind it: a module map, and a
diagram of one module's internals. [link: frame:<title>] on a node links it to
another frame on the same board, by the frame's title or id. Selecting the node
shows a link badge, and clicking it pans and zooms to that frame. The link is stored by frame id, so renaming the target
keeps it working; a title that matches no frame is reported as a warning.
A package is one box with a title over a row per item: a folder and its files, a module and its exports. It lays out as a single node, and an edge can land on one of its rows.
package Name [color] { items } declares it. Items are plain names separated
by commas or newlines; quote one that holds a comma. A colour tints the title.package/item in an edge points at that row: driver.ts -> tour/highlight.
The package name alone (tour/ or tour) points at the whole box.layer Name { members } draws a labelled band across the whole diagram and keeps
its members in that band. Layers stack in the order you write them, along the
flow: top to bottom with direction: down, left to right with right. Members
are nodes, packages or top-level groups, declared in the block or named from
elsewhere. A layered map of a codebase reads as rows: entries, features, core.
Each band lays its members out side by side, and fit: wraps a band too long
for the ratio onto more rows, so a band of many apps stays readable.
An edge connects two names. The connector token carries the meaning.
| Connector | Meaning |
|---|---|
-> | arrow |
<- | arrow, reversed |
<-> | bidirectional |
--> | dashed arrow (async or optional) |
<-- | dashed, reversed |
<--> | dashed bidirectional |
A statement is a series of hops between comma-separated name lists, read left to right: every name in one list connects to every name in the next. That gives you fan-out, fan-in, and chains for free.
Nodes may declare their attributes the first time they appear inside an edge:
An attribute list at the very end of a statement, after the label, belongs to
the edge. [red] colours the arrow; [flow] animates it as a live data flow:
travelling dots on a solid line, marching dashes on a dashed one;
[head: circle] and [head: cross] change the mark at the target end, reading
as "attaches to" and "does not reach"; [invisible] ranks the layout and draws
nothing, for when one node has to sit past another without an arrow claiming a
relationship. For an unlabelled edge, anchor the attributes after a bare colon:
A -> B : [flow]. Without the colon, [flow], [head: …] and [invisible]
still belong to the edge, and so does a colour when B is already declared; a
colour on a B seen for the first time colours the box.
A diagram whose story is a loop (a hub hands work out and gets the result back) reads best when the forward flow is drawn straight and the returns stay out of its way:
[back] marks a return edge. It takes no part in ranking, so the flow keeps
its order, and it is drawn in a lane outside the diagram. Several returns into
the same node share one lane and one arrival instead of running side by side.spine: names the main path. Its nodes sit on one straight row (one column in
a top-down diagram), and everything else branches off it.fit: asks for a proportion. A layout that comes out much longer or taller
than it wraps its rows, or a top-down one its columns, toward the ratio.A three-tier web application, grouped by layer, with an animated request path and a legend.
An event-driven pipeline with cloud icons and a fan-out to workers.