Skip to content

Instantly share code, notes, and snippets.

@edburns
Created June 27, 2025 20:42
Show Gist options
  • Save edburns/c035894c940ff4f121693c0eca94e425 to your computer and use it in GitHub Desktop.
Save edburns/c035894c940ff4f121693c0eca94e425 to your computer and use it in GitHub Desktop.
mermaid-direction-cheat-sheet.md

Mermaid Graph Direction Cheat Sheet

Mermaid diagrams support different flow directions using the graph keyword followed by a direction specifier.

πŸ“Œ Supported Directions

Keyword Meaning Layout Direction
TD Top Down Nodes flow Top β†’ Down (default)
TB Top Bottom (alias of TD) Same as TD
LR Left to Right Nodes flow Left β†’ Right
RL Right to Left Nodes flow Right β†’ Left
BT Bottom to Top Nodes flow Bottom β†’ Top

πŸ”„ Visual Examples

graph TD

graph TD
    A[Start] --> B[Process] --> C[End]
Loading

graph LR

graph LR
    A[Start] --> B[Process] --> C[End]
Loading

graph RL

graph RL
    A[Start] --> B[Process] --> C[End]
Loading

graph BT

graph BT
    A[Start] --> B[Process] --> C[End]
Loading

πŸ“ How to Use

In a Markdown file:

```mermaid graph LR A --> B ```

That's it!


Made for: Ed Burns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment