Excalidraw Diagram Generation
Generate .excalidraw JSON files that open directly in Excalidraw. These diagrams have a distinctive hand-drawn aesthetic.
Quick Start
Minimal valid file:
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [],
"appState": { "viewBackgroundColor": "#ffffff" },
"files": {}
}
Workflow
- Identify diagram type (flowchart, architecture, sequence, mind map, wireframe, org chart)
- Plan element layout with consistent spacing (use 20px grid)
- Generate elements with unique IDs and proper bindings
- Write complete JSON to
.excalidraw file
Element Patterns
Shape with Label
Always bind text to container bidirectionally:
// Rectangle
{
"type": "rectangle",
"id": "box_1",
"x": 100, "y": 100, "width": 150, "height": 60,
"backgroundColor": "#a5d8ff",
"boundElements": [{ "id": "text_1", "type": "text" }],
...baseProps
}
// Bound text
{
"type": "text",
"id": "text_1",
"containerId": "box_1",
"textAlign": "center",
"verticalAlign": "middle",
...textProps
}
Connected Arrow
Update both arrow and shapes:
// Arrow
{
"type": "arrow",
"id": "arrow_1",
"points": [[0, 0], [150, 0]],
"startBinding": { "elementId": "box_1", "fixedPoint": [1.0, 0.5001], "mode": "orbit" },
"endBinding": { "elementId": "box_2", "fixedPoint": [0.0, 0.5001], "mode": "orbit" },
"endArrowhead": "arrow",
...baseProps
}
// Both shapes need boundElements updated
"boundElements": [{ "id": "arrow_1", "type": "arrow" }]
Diagram-Specific Patterns
Flowchart: Ellipse (start/end), Rectangle (process), Diamond (decision), vertical flow with 70px gaps
Sequence Diagram: Rectangles (actors) at top, dashed vertical lines (lifelines), horizontal arrows (messages)
Architecture: Rectangles with rounded corners, group related components, use frames for boundaries
Mind Map: Central ellipse, radiating lines to topic rectangles, organic layout
Org Chart: Rectangles with hierarchy, lines (not arrows) for connections
Wireframe: Rectangles for UI sections, text placeholders, simple shapes for buttons/forms
Critical Rules
Bidirectional bindings - When arrow connects to shape, update BOTH:
- Arrow's
startBinding/endBinding
- Shape's
boundElements array
fixedPoint precision - Use 0.5001 not 0.5 to avoid floating point issues
Unique IDs - Every element needs unique id
Calculate width/height for lines/arrows from points array
Required base properties for every element:
id, type, x, y, width, height, angle, strokeColor, backgroundColor,
fillStyle, strokeWidth, strokeStyle, roughness, opacity, roundness,
seed, version, versionNonce, isDeleted, updated, groupIds, frameId,
boundElements, link, locked, index
Common Values
Colors:
- Stroke:
#1e1e1e (black), #e03131 (red), #2f9e44 (green), #1971c2 (blue)
- Background:
#a5d8ff (blue), #b2f2bb (green), #ffec99 (yellow), #ffc9c9 (red), #d0bfff (purple)
Defaults:
strokeWidth: 2
roughness: 1 (hand-drawn), 0 (smooth for text)
opacity: 100
fontFamily: 5 (Excalifont)
fontSize: 20
seed: any random integer
version: 1, versionNonce: 0
index: "a0", "a1", "a2"...
Element Types
| Type |
Use For |
rectangle |
Process, container, UI element |
ellipse |
Start/end, central node |
diamond |
Decision point |
line |
Connection without arrow |
arrow |
Directional flow |
text |
Labels, standalone text |
frame |
Grouping boundary |
When to Use Excalidraw
- Hand-drawn aesthetic desired
- Interactive diagram editing needed
- Whiteboard-style brainstorming
- Presentations and documentation with visual appeal
- When visual style matters more than precision
- Team collaboration on diagrams
Reference
See references/format-spec.md for complete element schemas, all property values, and detailed examples.
1---2name: excalidraw-23description: Generate Excalidraw diagrams (.excalidraw JSON files) for whiteboarding, flowcharts, architecture diagrams, sequence diagrams, mind maps, wireframes, and org charts. Use when user requests diagrams, visual documentation, system architecture visualization, process flows, or any hand-drawn style diagram. Triggers on requests mentioning Excalidraw, diagram creation, flowcharts, architecture diagrams, sequence diagrams, wireframes, or visual documentation.4---56# Excalidraw Diagram Generation78Generate `.excalidraw` JSON files that open directly in Excalidraw. These diagrams have a distinctive hand-drawn aesthetic.910## Quick Start1112Minimal valid file:13```json14{15 "type": "excalidraw",16 "version": 2,17 "source": "https://excalidraw.com",18 "elements": [],19 "appState": { "viewBackgroundColor": "#ffffff" },20 "files": {}21}22```2324## Workflow25261. Identify diagram type (flowchart, architecture, sequence, mind map, wireframe, org chart)272. Plan element layout with consistent spacing (use 20px grid)283. Generate elements with unique IDs and proper bindings294. Write complete JSON to `.excalidraw` file3031## Element Patterns3233### Shape with Label3435Always bind text to container bidirectionally:36```json37// Rectangle38{39 "type": "rectangle",40 "id": "box_1",41 "x": 100, "y": 100, "width": 150, "height": 60,42 "backgroundColor": "#a5d8ff",43 "boundElements": [{ "id": "text_1", "type": "text" }],44 ...baseProps45}46// Bound text47{48 "type": "text",49 "id": "text_1",50 "containerId": "box_1",51 "textAlign": "center",52 "verticalAlign": "middle",53 ...textProps54}55```5657### Connected Arrow5859Update both arrow and shapes:60```json61// Arrow62{63 "type": "arrow",64 "id": "arrow_1",65 "points": [[0, 0], [150, 0]],66 "startBinding": { "elementId": "box_1", "fixedPoint": [1.0, 0.5001], "mode": "orbit" },67 "endBinding": { "elementId": "box_2", "fixedPoint": [0.0, 0.5001], "mode": "orbit" },68 "endArrowhead": "arrow",69 ...baseProps70}71// Both shapes need boundElements updated72"boundElements": [{ "id": "arrow_1", "type": "arrow" }]73```7475## Diagram-Specific Patterns7677**Flowchart:** Ellipse (start/end), Rectangle (process), Diamond (decision), vertical flow with 70px gaps7879**Sequence Diagram:** Rectangles (actors) at top, dashed vertical lines (lifelines), horizontal arrows (messages)8081**Architecture:** Rectangles with rounded corners, group related components, use frames for boundaries8283**Mind Map:** Central ellipse, radiating lines to topic rectangles, organic layout8485**Org Chart:** Rectangles with hierarchy, lines (not arrows) for connections8687**Wireframe:** Rectangles for UI sections, text placeholders, simple shapes for buttons/forms8889## Critical Rules90911. **Bidirectional bindings** - When arrow connects to shape, update BOTH:92 - Arrow's `startBinding`/`endBinding`93 - Shape's `boundElements` array94952. **fixedPoint precision** - Use `0.5001` not `0.5` to avoid floating point issues96973. **Unique IDs** - Every element needs unique `id`98994. **Calculate width/height** for lines/arrows from points array1001015. **Required base properties** for every element:102 ```103 id, type, x, y, width, height, angle, strokeColor, backgroundColor,104 fillStyle, strokeWidth, strokeStyle, roughness, opacity, roundness,105 seed, version, versionNonce, isDeleted, updated, groupIds, frameId,106 boundElements, link, locked, index107 ```108109## Common Values110111**Colors:**112- Stroke: `#1e1e1e` (black), `#e03131` (red), `#2f9e44` (green), `#1971c2` (blue)113- Background: `#a5d8ff` (blue), `#b2f2bb` (green), `#ffec99` (yellow), `#ffc9c9` (red), `#d0bfff` (purple)114115**Defaults:**116- `strokeWidth`: 2117- `roughness`: 1 (hand-drawn), 0 (smooth for text)118- `opacity`: 100119- `fontFamily`: 5 (Excalifont)120- `fontSize`: 20121- `seed`: any random integer122- `version`: 1, `versionNonce`: 0123- `index`: "a0", "a1", "a2"...124125## Element Types126127| Type | Use For |128|------|---------|129| `rectangle` | Process, container, UI element |130| `ellipse` | Start/end, central node |131| `diamond` | Decision point |132| `line` | Connection without arrow |133| `arrow` | Directional flow |134| `text` | Labels, standalone text |135| `frame` | Grouping boundary |136137## When to Use Excalidraw138139- Hand-drawn aesthetic desired140- Interactive diagram editing needed141- Whiteboard-style brainstorming142- Presentations and documentation with visual appeal143- When visual style matters more than precision144- Team collaboration on diagrams145146## Reference147148See [references/format-spec.md](references/format-spec.md) for complete element schemas, all property values, and detailed examples.