Skip to content

Commit 29bedeb

Browse files
angrycaptain19Guillaumeclaudekaneel
authored
Feature: adds mind map diagram types to Mermaid (tldraw#8285)
Adds in support for mind maps as a new diagram type in mermaid. <img width="456" height="301" alt="Screenshot 2026-03-19 at 15 10 12" src="https://github.com/user-attachments/assets/e5cfe2b7-5174-4275-a5df-501883f3b278" /> <img width="1173" height="413" alt="Screenshot 2026-03-19 at 15 10 20" src="https://github.com/user-attachments/assets/21e17731-dabb-4230-a8b3-bba12eb28ee9" /> ### Change type - [ ] `bugfix` - [ ] `improvement` - [x] `feature` - [ ] `api` - [ ] `other` ### Test plan 1. Run the Mermaid diagrams example and compare the 20 mind map shapes vs the generated SVGs 2. Enable copy/paste handling for Mermaid code and try pasting in: ``` mindmap root((My Project)) Planning Goals Timeline Budget Development Frontend UI Design Components Backend API Database Marketing Social Media SEO Ads Launch Testing Deployment Feedback ``` ### Release notes - Adds mind map shape support to the @tldraw/mermaid package --------- Co-authored-by: Guillaume <guillaume@tldraw.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Guillaume Richard <mynameiskaneel@proton.me>
1 parent 6125f40 commit 29bedeb

9 files changed

Lines changed: 819 additions & 1 deletion

File tree

apps/examples/src/examples/use-cases/hundred-mermaids/MermaidDiagramsExample.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function TopPanel() {
7272
startOnLoad: false,
7373
flowchart: { useMaxWidth: false, nodeSpacing: 80, rankSpacing: 80, padding: 20 },
7474
state: { useMaxWidth: false, nodeSpacing: 80, rankSpacing: 80, padding: 20 },
75+
mindmap: { useMaxWidth: false, padding: 20 },
7576
sequence: { useMaxWidth: false, actorMargin: 50, noteMargin: 20 },
7677
themeVariables: { fontSize: `${18 * FONT_INFLATE}px` },
7778
})

apps/examples/src/examples/use-cases/hundred-mermaids/mermaids.ts

Lines changed: 347 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,4 +1024,351 @@ sequenceDiagram
10241024
Worker->>Worker: parse chunk 3 with a suspiciously long status label for layout testing
10251025
deactivate Worker`,
10261026
],
1027+
[
1028+
`mindmap
1029+
Root
1030+
A
1031+
B
1032+
C`,
1033+
`mindmap
1034+
root[Square]
1035+
A
1036+
B`,
1037+
`mindmap
1038+
root(Rounded square)
1039+
A
1040+
B`,
1041+
`mindmap
1042+
root((Circle))
1043+
A
1044+
B`,
1045+
`mindmap
1046+
root)Cloud(
1047+
A
1048+
B`,
1049+
`mindmap
1050+
root{{Hexagon}}
1051+
A
1052+
B`,
1053+
`mindmap
1054+
Root
1055+
A
1056+
B
1057+
C`,
1058+
`mindmap
1059+
Root
1060+
A
1061+
B
1062+
C
1063+
D
1064+
E
1065+
F`,
1066+
`mindmap
1067+
Project
1068+
Planning
1069+
Requirements
1070+
Timeline
1071+
Development
1072+
Frontend
1073+
Backend
1074+
Database
1075+
Testing
1076+
Unit tests
1077+
Integration`,
1078+
`mindmap
1079+
Web Development
1080+
Frontend
1081+
HTML
1082+
CSS
1083+
JavaScript
1084+
React
1085+
Vue
1086+
Angular
1087+
Backend
1088+
Node.js
1089+
Python
1090+
Go
1091+
DevOps
1092+
Docker
1093+
CI/CD
1094+
Monitoring`,
1095+
`mindmap
1096+
Company
1097+
Engineering
1098+
Platform
1099+
Product
1100+
Infrastructure
1101+
Design
1102+
UX
1103+
Visual
1104+
Marketing
1105+
Content
1106+
Analytics`,
1107+
`mindmap
1108+
root((Central Idea))
1109+
Branch A
1110+
Leaf 1
1111+
Leaf 2
1112+
Leaf 3
1113+
Branch B
1114+
Leaf 4
1115+
Leaf 5
1116+
Branch C
1117+
Leaf 6`,
1118+
`mindmap
1119+
root[Decision]
1120+
(Option A)
1121+
Pro 1
1122+
Pro 2
1123+
(Option B)
1124+
Pro 3
1125+
Con 1
1126+
(Option C)
1127+
Pro 4`,
1128+
`mindmap
1129+
Release Plan
1130+
v1.0
1131+
Core features
1132+
Bug fixes
1133+
Documentation
1134+
v1.1
1135+
Performance
1136+
New API
1137+
v2.0
1138+
Breaking changes
1139+
Migration guide
1140+
New architecture`,
1141+
`mindmap
1142+
Onboarding
1143+
Day 1
1144+
Setup
1145+
Intro meeting
1146+
Codebase tour
1147+
Week 1
1148+
First PR
1149+
Code review
1150+
Team lunch
1151+
Month 1
1152+
Own a feature
1153+
Present to team`,
1154+
`mindmap
1155+
root((tldraw))
1156+
Editor
1157+
Shapes
1158+
Tools
1159+
Bindings
1160+
Store
1161+
Records
1162+
Signals
1163+
UI
1164+
Components
1165+
Styles
1166+
Sync
1167+
Multiplayer
1168+
Persistence`,
1169+
`mindmap
1170+
Debugging
1171+
Check logs
1172+
Server logs
1173+
Client console
1174+
Reproduce
1175+
Steps
1176+
Environment
1177+
Fix
1178+
Root cause
1179+
Regression test
1180+
Deploy
1181+
Staging
1182+
Production`,
1183+
`mindmap
1184+
root[Quarterly Goals]
1185+
Reliability
1186+
Uptime target
1187+
Alerting
1188+
Incident response
1189+
Growth
1190+
New users
1191+
Retention
1192+
Activation
1193+
Platform
1194+
API v2
1195+
SDK improvements
1196+
Documentation`,
1197+
`mindmap
1198+
Meal Planning
1199+
Monday
1200+
Breakfast
1201+
Lunch
1202+
Dinner
1203+
Tuesday
1204+
Breakfast
1205+
Lunch
1206+
Dinner
1207+
Wednesday
1208+
Breakfast
1209+
Lunch
1210+
Dinner`,
1211+
`mindmap
1212+
root((AI))
1213+
Machine Learning
1214+
Supervised
1215+
Classification
1216+
Regression
1217+
Unsupervised
1218+
Clustering
1219+
Dimensionality Reduction
1220+
Deep Learning
1221+
CNNs
1222+
RNNs
1223+
Transformers
1224+
Applications
1225+
NLP
1226+
Computer Vision
1227+
Robotics`,
1228+
`mindmap
1229+
root((System Architecture))
1230+
Layer 1
1231+
Layer 2
1232+
Layer 3
1233+
Layer 4
1234+
Layer 5
1235+
Layer 6
1236+
Layer 7
1237+
Layer 8
1238+
Layer 9
1239+
Layer 10`,
1240+
`mindmap
1241+
root((Wide Node))
1242+
A1
1243+
A2
1244+
A3
1245+
A4
1246+
A5
1247+
A6
1248+
A7
1249+
A8
1250+
A9
1251+
A10
1252+
A11
1253+
A12
1254+
A13`,
1255+
`mindmap
1256+
root((Product))
1257+
Design
1258+
UX
1259+
Research
1260+
Personas
1261+
UI
1262+
Engineering
1263+
Backend
1264+
APIs
1265+
DB
1266+
Frontend
1267+
Components
1268+
State
1269+
Marketing
1270+
SEO
1271+
Ads
1272+
Social`,
1273+
`mindmap
1274+
root((Documentation))
1275+
"This is a very long node label intended to test text wrapping and overflow behavior"
1276+
"Another extremely verbose and descriptive child node that could break layouts"
1277+
"Even deeper explanation with excessive verbosity and complexity"`,
1278+
`mindmap
1279+
root((Company))
1280+
CEO
1281+
Strategy
1282+
CTO
1283+
Engineering
1284+
Platform
1285+
Infra
1286+
Kubernetes
1287+
Intern`,
1288+
`mindmap
1289+
root((Duplicates))
1290+
Node
1291+
Node
1292+
Node
1293+
Node
1294+
Node`,
1295+
`mindmap
1296+
root((Numbers))
1297+
1
1298+
1.1
1299+
1.1.1
1300+
2
1301+
2.1
1302+
2.2
1303+
3`,
1304+
`mindmap
1305+
root((AI System))
1306+
Data
1307+
Collection
1308+
Cleaning
1309+
Labeling
1310+
Model
1311+
Training
1312+
Evaluation
1313+
Deployment
1314+
Ethics
1315+
Bias
1316+
Privacy
1317+
Transparency`,
1318+
`mindmap
1319+
root((Hybrid))
1320+
A
1321+
A1
1322+
A1a
1323+
A1b
1324+
A2
1325+
B
1326+
B1
1327+
B2
1328+
B3
1329+
B3a
1330+
B3a1
1331+
C`,
1332+
`mindmap
1333+
root((Uneven))
1334+
Short
1335+
Medium
1336+
Mid1
1337+
Mid2
1338+
VeryLong
1339+
L1
1340+
L2
1341+
L3
1342+
L4
1343+
L5`,
1344+
`mindmap
1345+
root((Knowledge))
1346+
Science
1347+
Physics
1348+
Chemistry
1349+
Biology
1350+
Arts
1351+
Music
1352+
Painting
1353+
Dance
1354+
Technology
1355+
Software
1356+
Hardware
1357+
AI`,
1358+
`mindmap
1359+
root((Decision))
1360+
Start
1361+
Yes
1362+
Continue
1363+
Optimize
1364+
No
1365+
Stop
1366+
Retry`,
1367+
`mindmap
1368+
root((Edge))
1369+
""
1370+
" "
1371+
" "
1372+
Filled`,
1373+
],
10271374
]

packages/mermaid/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ Instead of rendering a static SVG, `@tldraw/mermaid` parses Mermaid text and cre
1010
npm i @tldraw/mermaid
1111
```
1212

13-
> **Peer dependency:** this package requires `tldraw` to be installed in your project.
13+
**Peer dependencies:** your app must also include compatible versions of:
14+
15+
- **`tldraw`** — the SDK this package plugs into
16+
- **`react`**`^18.2.0` or `^19.2.1`
17+
- **`react-dom`**`^18.2.0` or `^19.2.1`
1418

1519
## Quick start
1620

@@ -58,6 +62,7 @@ When `centerOnPosition` is `true` (the default), the diagram's center aligns wit
5862
| Flowchart | `flowchart`, `graph` | Geo shapes, arrows, subgraph frames |
5963
| Sequence diagram | `sequenceDiagram` | Actor shapes, lifelines, signal arrows, fragment frames |
6064
| State diagram | `stateDiagram-v2` | State shapes, transitions, compound state frames, fork/join, choice |
65+
| Mindmap | `mindmap` | Colored geo shapes, parent-child edges, tree hierarchy |
6166

6267
Unsupported diagram types (pie, gantt, class, ER, etc.) can be handled with the `onUnsupportedDiagram` callback — for example, to fall back to SVG import:
6368

packages/mermaid/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
"mermaid": "11.12.2"
4646
},
4747
"peerDependencies": {
48+
"react": "^18.2.0 || ^19.2.1",
49+
"react-dom": "^18.2.0 || ^19.2.1",
4850
"tldraw": "workspace:*"
4951
},
5052
"devDependencies": {

0 commit comments

Comments
 (0)