Diagram example

Swimlane diagram in Mermaid

A swimlane diagram puts each step in the lane of the person or team who does it, so hand-offs are visible. Mermaid has no dedicated swimlane type, but one subgraph per lane does the job. Here is a purchase-approval process across three lanes.

Updated

Purchase approval: Requester, Manager, Finance Edit and export
flowchart LR
  subgraph req [Requester]
    direction LR
    r1([Need a purchase]) --> r2[Fill request form]
  end
  subgraph mgr [Manager]
    direction LR
    m1{Approve?}
  end
  subgraph fin [Finance]
    direction LR
    f1[Check budget] --> f2{Under budget?}
    f2 -->|Yes| f3[Issue purchase order]
  end
  r2 --> m1
  m1 -->|No| r3([Request closed])
  m1 -->|Yes| f1
  f2 -->|No| m1
  f3 --> r4([Order placed])

Opens Arrowly with this process written as notes: change what differs in your team, and it redraws the diagram.

How the lanes are built

  • One subgraph per lane, titled with the role: subgraph fin [Finance].
  • Each step is declared inside its lane, so it is drawn there.
  • Links between lanes are written after all the lanes, at the bottom. Those are the hand-offs.
  • With flowchart LR, the process reads left to right and each lane appears where its hand-offs lead, as in the example above: Requester, then Manager, then Finance.

Because inner nodes link across lanes, Mermaid ignores each lane's own direction and uses the chart's direction (a documented rule). Set the direction you want on the first line, flowchart LR or flowchart TD, and treat direction inside lanes as a hint only.

Keeping the lanes readable

ProblemFix
Lanes appear in the wrong orderDeclare them in the order you want, and make sure the first hand-off goes from lane 1 to lane 2
One lane is very longMerge small steps; a lane with more than six steps usually hides a sub-process
Arrows cross everywhereMove rejection paths to a terminal node in the same lane instead of looping back
Lane titles are cutKeep titles to one or two words; put the team name, not a sentence

Mermaid lays the diagram out automatically, so lanes won't be perfectly equal bands like in a drawing tool. If you need strict alignment for a formal process document, export the SVG and adjust it in a design tool.

Draw your process with lanes

Write who does what, in any order. Arrowly groups the steps into lanes, draws the hand-offs and gives you the Mermaid code. 3 free diagrams a day.

Draw my swimlane

Questions

Can I force lanes into horizontal or vertical bands?

Not reliably: Mermaid places each lane where the links lead. Changing the first line to flowchart TD makes the process read top to bottom. For strict bands in a formal document, export the SVG and align the lanes in a design tool.

Does Arrowly draw swimlanes?

Yes. When your notes say who does each step, Arrowly groups the steps into one lane per role, using the same subgraph technique.