Menu

Arrows

An arrow is written inside the card it leaves: to(target). Its classes style it, its text labels it.

Writing an arrow

card#api API
  to(db)                      //- api → db
  to(queue).dashed events     //- styled, with a label
card#db Database
card#queue Queue

The target is the #id of a card. An unknown target is an error, with a suggestion when the id is close to an existing one. Arrows may go backwards, form cycles, or link a card to several others.

Styles

{"skemo":1,"name":"arrows.skemo","source":"diagram(dir=\"right\")\n card#a1 A\n to(b1).dashed dashed\n card#b1 B\n card#a2 A\n to(b2).dotted dotted\n card#b2 B\n card#a3 A\n to(b3).flow flow\n card#b3 B\n card#a7 A\n to(b7).pulse pulse\n card#b7 B\n card#a4 A\n to(b4).both both\n card#b4 B\n card#a5 A\n to(b5).dot.nohead dot.nohead\n card#b5 B\n card#a6 A\n to(b6).link link\n card#b6 B\n","theme":"light"}ABABABABABABABdasheddottedflowpulsebothdot.noheadlink
{"skemo":1,"name":"arrows.skemo","source":"diagram(dir=\"right\")\n card#a1 A\n to(b1).dashed dashed\n card#b1 B\n card#a2 A\n to(b2).dotted dotted\n card#b2 B\n card#a3 A\n to(b3).flow flow\n card#b3 B\n card#a7 A\n to(b7).pulse pulse\n card#b7 B\n card#a4 A\n to(b4).both both\n card#b4 B\n card#a5 A\n to(b5).dot.nohead dot.nohead\n card#b5 B\n card#a6 A\n to(b6).link link\n card#b6 B\n","theme":"dark"}ABABABABABABABdasheddottedflowpulsebothdot.noheadlink
arrows.skemo
diagram(dir="right")
  card#a1 A
    to(b1).dashed dashed
  card#b1 B
  card#a2 A
    to(b2).dotted dotted
  card#b2 B
  card#a3 A
    to(b3).flow flow
  card#b3 B
  card#a7 A
    to(b7).pulse pulse
  card#b7 B
  card#a4 A
    to(b4).both both
  card#b4 B
  card#a5 A
    to(b5).dot.nohead dot.nohead
  card#b5 B
  card#a6 A
    to(b6).link link
  card#b6 B
ClassEffect
.dashed, .dotteddashed or dotted line
.thickthicker line
.flowdashes running towards the head
.pulsea glowing dot running from the source to the head
.botha head at both ends
.noheadno head
.dota dot at the start
.linkdotted, no head: attaches a note to a card
.wan, .securecolour examples of the default theme (red and thicker, green)

Classes combine (to(b).dashed.both). Your own classes colour arrows through CSS: .edge.important { color: #E8590C; }. When the direction or the kind of an arrow matters, give it a line style too, not only a colour, so it reads in black and white.

Arrows in motion (preview)

.flow and .pulse loop for as long as the diagram is shown. Every dot runs at the same speed, so the dots of all arrows leave together and a long arrow takes longer. They play in the HTML (stopped for a reader who asks for less motion), in GIF, APNG and animated WebP, and in the SVG when you ask for it with --motion. A still image draws them as plain solid lines. See Animated flows.

.edge.orders { --pulse-color: #E8590C; --pulse-size: 7px; --pulse-speed: 200px; }
.edge.flow   { --flow-speed: 30px; }   /* px per second */

Several targets

{"skemo":1,"name":"multi.skemo","source":"diagram(dir=\"down\")\n card#lb Load balancer\n to(w1 w2 w3)\n card#w1 Worker 1\n card#w2 Worker 2\n card#w3 Worker 3\n","theme":"light"}Load balancerWorker 1Worker 2Worker 3
{"skemo":1,"name":"multi.skemo","source":"diagram(dir=\"down\")\n card#lb Load balancer\n to(w1 w2 w3)\n card#w1 Worker 1\n card#w2 Worker 2\n card#w3 Worker 3\n","theme":"dark"}Load balancerWorker 1Worker 2Worker 3
multi.skemo
diagram(dir="down")
  card#lb Load balancer
    to(w1 w2 w3)
  card#w1 Worker 1
  card#w2 Worker 2
  card#w3 Worker 3

to(w1 w2 w3) creates one arrow per target, all with the same classes and label (a label is therefore repeated on each arrow).

Shared trunk

{"skemo":1,"name":"trunk.skemo","source":"diagram(dir=\"down\")\n card#ceo CEO\n to(cto cfo coo join=\"trunk\")\n card#cto CTO\n card#cfo CFO\n card#coo COO\n","theme":"light"}CEOCTOCFOCOO
{"skemo":1,"name":"trunk.skemo","source":"diagram(dir=\"down\")\n card#ceo CEO\n to(cto cfo coo join=\"trunk\")\n card#cto CTO\n card#cfo CFO\n card#coo COO\n","theme":"dark"}CEOCTOCFOCOO
trunk.skemo
diagram(dir="down")
  card#ceo CEO
    to(cto cfo coo join="trunk")
  card#cto CTO
  card#cfo CFO
  card#coo COO

With join="trunk", the arrows of one to(…) leave the same point and share a trunk before branching, the way organisation charts are drawn. Each target still has its own arrow, with its own id and animation marker.

(preview) Arrows from one card to several cards of the next row, alike (same classes, no label or the same label), are drawn this way without asking when the side is crowded or they would cross a row of cards (a fork); a shared label is written once. When several cards each link to the same cards of the next row, every one to every one, their arrows share one bar between the rows (a bus) instead of crossing. Junctions are rounded bends into the trunk. Where two lines still cross, the horizontal one is cut on each side of the other.

(preview) Any other name joins arrows into one card: arrows to the same card that carry the same join="http", written under different cards, meet before it and end on one line with a single head (the HTTP calls of two frontends to one backend, in the Kubernetes example of Layout). A name that no other arrow to that card carries is reported and ignored. Their label names the whole flow: it sits on the part the arrows share, just before the card.

A line without a head (.nohead, .link, a head shown as a dot) runs right up to the card.

Tunnels (preview)

{"skemo":1,"name":"tunnel.skemo","source":"diagram(dir=\"right\")\n zone#paris Paris site\n card#app(icon=\"skemo-container\") Orders app\n to(db tunnel=\"vpn\") SQL\n to(s3 tunnel=\"vpn\") Backups\n to(web) Health\n card#gw-a(icon=\"skemo-vpn\") VPN gateway\n tunnel#vpn(gw-b) IPsec\n zone#lyon Lyon site\n card#gw-b(icon=\"skemo-vpn\") VPN gateway\n card#db(icon=\"skemo-server\") Database\n card#s3(icon=\"skemo-object-storage\") Object storage\n card#web(icon=\"skemo-web\") Status page\n","theme":"light"}PARIS SITEOrders appVPN gatewayLYON SITEVPN gatewayDatabaseObject storageStatus pageSQLBackupsHealthIPsec
{"skemo":1,"name":"tunnel.skemo","source":"diagram(dir=\"right\")\n zone#paris Paris site\n card#app(icon=\"skemo-container\") Orders app\n to(db tunnel=\"vpn\") SQL\n to(s3 tunnel=\"vpn\") Backups\n to(web) Health\n card#gw-a(icon=\"skemo-vpn\") VPN gateway\n tunnel#vpn(gw-b) IPsec\n zone#lyon Lyon site\n card#gw-b(icon=\"skemo-vpn\") VPN gateway\n card#db(icon=\"skemo-server\") Database\n card#s3(icon=\"skemo-object-storage\") Object storage\n card#web(icon=\"skemo-web\") Status page\n","theme":"dark"}PARIS SITEOrders appVPN gatewayLYON SITEVPN gatewayDatabaseObject storageStatus pageSQLBackupsHealthIPsec
tunnel.skemo
diagram(dir="right")
  zone#paris Paris site
    card#app(icon="skemo-container") Orders app
      to(db tunnel="vpn") SQL
      to(s3 tunnel="vpn") Backups
      to(web) Health
    card#gw-a(icon="skemo-vpn") VPN gateway
      tunnel#vpn(gw-b) IPsec
  zone#lyon Lyon site
    card#gw-b(icon="skemo-vpn") VPN gateway
    card#db(icon="skemo-server") Database
    card#s3(icon="skemo-object-storage") Object storage
  card#web(icon="skemo-web") Status page

tunnel joins two cards with a tube: a VPN between two gateways, a link between two sites. It is written like an arrow, inside one of the two cards (tunnel#vpn(gw-b) IPsec), with an id, classes, a label and markers, but no head. An arrow passes through it when it names it, to(db tunnel="vpn"): it runs into the near end, along the tunnel on a lane of its own, and out of the far end to its target, as one line hidden inside the two cards. The tube widens by a lane for each arrow; arrows that do not name it (here the health check) go their own way.

Arrows outside the layout (preview)

{"skemo":1,"name":"constraint.skemo","source":"diagram(dir=\"down\")\n card#client Client\n to(svc)\n card#dns CoreDNS\n card#svc Service\n to(p1 p2)\n card#p1 Pod 1\n to(dns constraint=\"false\").dashed\n card#p2 Pod 2\n to(dns constraint=\"false\").dashed\n","theme":"light"}ClientCoreDNSServicePod 1Pod 2
{"skemo":1,"name":"constraint.skemo","source":"diagram(dir=\"down\")\n card#client Client\n to(svc)\n card#dns CoreDNS\n card#svc Service\n to(p1 p2)\n card#p1 Pod 1\n to(dns constraint=\"false\").dashed\n card#p2 Pod 2\n to(dns constraint=\"false\").dashed\n","theme":"dark"}ClientCoreDNSServicePod 1Pod 2
constraint.skemo
diagram(dir="down")
  card#client Client
    to(svc)
  card#dns CoreDNS
  card#svc Service
    to(p1 p2)
  card#p1 Pod 1
    to(dns constraint="false").dashed
  card#p2 Pod 2
    to(dns constraint="false").dashed

constraint="false" draws and routes an arrow without letting it shape the layout: its target is not pushed a row further. Use it for cross links (service discovery, monitoring, callbacks) that would otherwise turn the diagram into a long chain. Here CoreDNS stays beside the pods instead of below them.

Classes from the endpoints

{"skemo":1,"name":"edge-classes.skemo","source":"diagram(dir=\"right\")\n card#u1.uplink Uplink A\n to(core)\n card#u2.uplink Uplink B\n to(core)\n card#core.t1 Core\n to(srv)\n card#srv.t2 Servers\n","css":[{"name":"edge-classes.css","content":".uplink { --c: #7B5CC4; --label: \"UPLINK\"; }\n/* every arrow leaving an uplink card takes its colour */\n.edge.from-uplink { color: #7B5CC4; }\n"}],"theme":"light"}UPLINKUplink AUPLINKUplink BT1CoreT2Servers
{"skemo":1,"name":"edge-classes.skemo","source":"diagram(dir=\"right\")\n card#u1.uplink Uplink A\n to(core)\n card#u2.uplink Uplink B\n to(core)\n card#core.t1 Core\n to(srv)\n card#srv.t2 Servers\n","css":[{"name":"edge-classes.css","content":".uplink { --c: #7B5CC4; --label: \"UPLINK\"; }\n/* every arrow leaving an uplink card takes its colour */\n.edge.from-uplink { color: #7B5CC4; }\n"}],"theme":"dark"}UPLINKUplink AUPLINKUplink BT1CoreT2Servers
edge-classes.skemo
diagram(dir="right")
  card#u1.uplink Uplink A
    to(core)
  card#u2.uplink Uplink B
    to(core)
  card#core.t1 Core
    to(srv)
  card#srv.t2 Servers
edge-classes.css
.uplink { --c: #7B5CC4; --label: "UPLINK"; }
/* every arrow leaving an uplink card takes its colour */
.edge.from-uplink { color: #7B5CC4; }

Every arrow automatically receives the classes from-<type> and to-<type> of the cards it joins, so one CSS rule can colour all arrows leaving or entering a type.

Sides, waypoints, ids

AttributeEffect
side="right-top"attachment side at the start and at the end, among top bottom left right. One half may stay empty: side="-top"
via="x,y x,y"waypoints the route passes through, in order
href="…"the arrow is a link (SVG and HTML)
to#id(…)an explicit id; by default an arrow is called source->target (then #2, #3 for duplicates)

See Layout and positions for when to use side and via.

Routing

Every arrow is routed with right angles, around the cards and around the zones that contain neither of its ends. Bends sit in the middle of the free corridor, and arrows that share a side are spread apart. You never draw a route yourself.