Flowcharts: click events and tooltips
简介 / Introduction
Flowcharts are not just static diagrams — they can embed hyperlinks and click events, letting readers click a node to jump to a page or trigger a tooltip. This post shows how both engines implement this.
PlantUML 版
PlantUML uses the -> prefix syntax to declare nodes as HTML hyperlinks and the tooltip attribute to add tooltip text:
1 | @startsalt |
PlantUML’s -> syntax generates <a href="..."> tags when rendered as HTML, making nodes clickable. The startsalt renderer provides a simple table layout well suited for embedding doc-sidebars or help pages.
Mermaid 版
Mermaid uses the click directive to bind events to nodes, supporting both URL跳转 and JavaScript 函数调用:
1 | flowchart TD |
click node href "url" turns a node into a clickable hyperlink; the trailing "tooltip text" is an optional tooltip. Mermaid also supports click node callback to invoke JavaScript functions for custom popups and other interactions.
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Clickable node syntax | node -> "url" |
click node href "url" |
| Tooltip text | tooltip "xxx" (attribute) |
"tooltip" (click suffix) |
| JS function binding | Not supported | click node callback |
| Required renderer | @startsalt or @startuml (HTML mode) |
flowchart |
小结 / Wrap-up
Both engines can turn flowcharts into interactive navigation maps. Mermaid’s click href syntax is more intuitive and also supports JS callbacks; PlantUML’s -> linking is compact and fits naturally in doc-sidebars or help pages. Prefer Mermaid when you need JS callbacks, and PlantUML for simple embedded links.
- Title: Flowcharts: click events and tooltips
- Author: puml.online
- Created at : 2026-09-14 01:00:26
- Updated at : 2026-09-29 01:06:38
- Link: https://puml.online/blog/flowchart-click-events-en/
- License: This work is licensed under CC BY-NC-SA 4.0.