Text to diagram
Text to diagram draws a diagram on the canvas from a written idea or from Mermaid code. The Excalidraw web app has a Text to diagram tab that writes the diagram from your prompt, and a Mermaid tab that draws the code you type. Both open from More tools, under Generate, in the toolbar.
On this page
Who can use it
The Text to diagram tab is in the Excalidraw web app. The Mermaid to Excalidraw item opens the Mermaid tab, and both sit under Generate in the toolbar's More tools menu. The Text to diagram item is hidden when AI is turned off. Where the editor has no text-to-diagram dialog of its own, the dialog opens as Mermaid to Excalidraw with its code box and no tabs.
Generate a diagram from a prompt
Open More tools in the toolbar, then select Text to diagram under Generate. The tab carries an AI Beta badge.
Type your idea in the box and press Enter. Press Shift + Enter for a new line. In an empty chat the box reads “Start typing your diagram idea here... (Shift + Enter for new line)”.
While the reply comes in, the box reads “Generating...” and the send button becomes a stop icon, with no label. Select it to stop the reply. A stopped reply shows no error.
Once the chat has a reply, its diagram is previewed beside the chat. Select Insert in the preview to add it to the canvas.
The diagram is added at the center of the canvas, scaled down to fit, and the dialog closes.
Each reply also has an Insert icon, which adds that reply's diagram the same way. The icon is hidden on a reply that failed.
To edit a reply's code, select View as Mermaid. It opens the code in the Mermaid tab.
Draw Mermaid code
Open More tools and select Mermaid to Excalidraw under Generate. The tab is called Mermaid.
Type or paste Mermaid code in the box. The preview draws it as you type.
Select Insert. In the plain text box, Ctrl or Cmd with Enter also inserts.
The box keeps the code in this browser. It saves after you stop typing and when you leave the page. If nothing is saved, the box starts with a sample flowchart.
Five kinds of diagram are drawn: flowcharts, sequence diagrams, class diagrams, state diagrams and entity relationship diagrams. Each starts with its own first line, such as flowchart TD or erDiagram. Flowcharts are drawn with elbow arrows.
Your chats stay in this browser
Chats are saved in this browser. Only the 10 most recent chats are kept. A chat is saved when a reply finishes and when you start a new one. Its title is the first prompt, cut to 47 characters and followed by “...” when it is longer than 50 characters.
- New Chat starts an empty chat. It shows once the chat has messages, and it is off while a reply is generating.
- The button titled Menu lists your saved chats. It shows once a chat is saved.
- Select a chat in that list to reopen it.
- Each chat has a trash icon titled Delete chat. Deleting the open chat opens the newest of the others, or an empty chat when none are left.
Prompt and request limits
- A prompt is 3 to 10,000 characters.
- count requests left today shows how many requests are left today.
- The count shows as a warning below 5 left.
- At 0 left, the box is disabled and reads “You've reached your message limit”. Sending is off, and so is the Regenerate (auto-fix) → button.
If a reply or diagram fails
What you see | What it means | What to do |
|---|---|---|
“Prompt is too short (min 3 characters)” | What it means Your prompt has fewer than 3 characters. | What to do Type a longer prompt. |
“Prompt is too long (max 10000 characters)” | What it means Your prompt is longer than 10,000 characters. | What to do Shorten the prompt. |
“Generated an invalid diagram :(. You may edit manually, retry with auto-fix, or try a different prompt.” with Edit Mermaid manually → and Regenerate (auto-fix) → | What it means The latest reply is not valid Mermaid, so it can't be drawn. | What to do Select Edit Mermaid manually → to open its code in the Mermaid tab. Or select Regenerate (auto-fix) → to ask the AI to fix it. |
“Request failed”, or the message the AI service sends | What it means The request did not finish. | What to do Select Retry under the reply. It turns on 5 seconds after the last try and sends your last prompt again. |
“Generation failed” | What it means The request failed and no reply came back. | What to do Send the prompt again. |
“Hold your horses, you're too fast for us! Please wait a moment before trying again.” | What it means You sent requests too fast, or the service refused one as too many. The last reply is removed. | What to do Wait a moment, then send again. |
“You've hit your AI limit on the free plan. Try out Excalidraw+ for more or come back tomorrow.” with Upgrade to Plus | What it means No requests are left. | What to do Come back tomorrow, or select Upgrade to Plus, which opens the Excalidraw+ page in a new tab. |
What you see | What it means | What to do |
|---|---|---|
“Syntax error near line N.” or “Syntax error in Mermaid diagram.”, with “Likely causes:” | What it means The Mermaid code can't be read. The list gives the likely causes. | What to do Fix one of the causes listed. If Auto-fix is available appears, select it. |
“Unknown diagram type.” | What it means The first line does not name a diagram type. | What to do Start with |
Auto-fix is available | What it means A changed version of the code draws. | What to do Select it to replace the code with that version. |
“Couldn't load Mermaid. Check your internet connection and try again.” with Retry | What it means The converter did not load, for example because you are offline. | What to do Select Retry. The box also retries when you are back online. |
“Couldn't load Mermaid. Reload the page to try again.” with Reload | What it means The converter failed to load while you were online, so a reload is needed. | What to do Select Reload. |