Cheatsheet
Everything on one page. The full rules are in Syntax.
title: Cheatsheet
direction: right
.svc [blue]
.store [amber, cylinder]
user "Customer" [circle, purple]
group core "Core" {
api "API" .svc [sub: "Node, 3 pods"]
worker "Worker" .svc
}
db "Postgres" .store
user -> api: HTTPS
api -> db: SQL
api --> worker: job [flow]
worker ..> db: [dashed]Statements
| write | means |
|---|---|
title: Checkout | setting (direction, theme, curve, legend ...) |
api "API Gateway" | node with id api and a label |
api "API" [color: blue, shape: hexagon] | node with props |
api "API" [blue, hexagon] | same: a bare value names its key |
a, b, c | several nodes |
a -> b -> c | chain |
a, b -> c | fan-in (a -> c, b -> c) |
a -> b: label | edge label |
a -> b: label [dashed] | edge label and edge props |
a -> b: [dashed] | edge props, no label |
.svc [blue] | define a class |
api "API" .svc | apply a class |
group core "Core" { ... } | group, may nest |
$brand: #2563eb then [fill: $brand] | variable |
def svc(id, name) { ... } then svc(api, "API") | component |
import "./shared.yu" | pull in another file |
# comment / // comment | comment |
Arrows
| arrow | line | heads |
|---|---|---|
-> | solid | end |
--> | dashed | end |
..> | dotted | end |
=> | thick | end |
<->, <-->, <=> | solid, dashed, thick | both |
--, -, .., == | solid, solid, dotted, thick | none |
a <- b | same as b -> a |
Props you use most
| prop | on | values |
|---|---|---|
color | node, group, edge | fill, border and text in one: blue, #e11d48, rgb(…), tomato |
shape | node | rounded, box, pill, circle, diamond, hexagon, cylinder, document, note, text ... |
sub | node | second, smaller line |
icon | node | an emoji before the label |
link | node | http(s), mailto, # or relative URL; the node becomes clickable |
style | edge, sequence message | solid, dashed, dotted |
edge-color, edge-width | setting, panel | default ink and width of edges, messages, Gantt arrows |
flow | edge | true animates the edge |
curve | edge, setting | smooth, orthogonal, straight |
exit, enter | edge | top, right, bottom, left, auto |
constraint | edge | false: the edge does not affect layout |
below, right-of, ... | node | a node id: place this node next to it, without an edge |
max-width | setting | px: wide right/left diagrams wrap into rows |
text, font-size, ... | node, edge, group, panel | label colour, font, size, font-weight, italic; {size: 18, red | part} styles part of a text |
yuhwa guide lists every prop and every allowed value. Tones: slate, gray, red, orange, amber, lime, green, teal, cyan, blue, indigo, purple, pink.
Panels
| block | draws |
|---|---|
sequence id "Title" { ... } | sequence diagram |
timeline id "Title" { ... } | timeline |
chart id "Title" [type: pie] { ... } | bar, column, line, pie or donut chart |
git id "Title" { ... } | git history |
gantt id "Title" { ... } | gantt chart: tasks, dependencies, milestones |
quadrant id "Title" { ... } | 2x2 matrix with points |
mindmap id "Title" { ... } | mind map from an indented outline |
kanban id "Title" { ... } | board of columns and cards |
treeview id "Title" { ... } | file tree or outline, with icons |
Panel bodies hold one statement per line. A line's [props] go before its colon or at its end: EU [green]: 46 and EU: 46 [green] are the same. Where the end is free text (timeline titles, quadrant labels), a bracket at the end counts only when it is a colour, so 2025: Launch [beta] keeps its text. Sequence messages take their props at the end only: a -> b: hi [red]. Every kind has its own page under Diagram types. panels: row|column|grid|wrap arranges them next to the graph. See Combining diagrams.
Common mistakes
| wrong | right | why |
|---|---|---|
Web Server -> db | web "Web Server" -> db | a multi-word label needs an id and quotes |
a -> b [dashed] | a -> b: [dashed] | props before the colon style node b |
a -> b "calls" | a -> b: calls | a quoted string after b renames b |
A[Label] | A "Label" | Mermaid syntax |
a -->|yes| b | a --> b: yes | Mermaid syntax |
subgraph x ... end | group x "X" { ... } | Mermaid syntax |
%% note | # note | Mermaid syntax |
pie p { ... } | chart p [type: pie] { ... } | Mermaid syntax |
a -> b [red]: hi (sequence) | a -> b: hi [red] | message props go at the end |
core -> db (group) | api -> db | edges connect nodes, not groups |
a -> x: [opacity: 0] | x [right-of: a] | placement needs no invisible edge |
Every one of these gets a diagnostic that names the fix. Run yuhwa check file.yu and fix everything it reports.