Edit on the canvas

Manual mode

Manual mode lets you edit a flowchart, state diagram, sequence diagram, ER diagram, or class diagram on the canvas with the mouse. The Mermaid code is still the diagram: each change you make on the canvas is written into the code straight away, and the code panel shows it as you work. Manual mode works on every plan, signed in or not. Other diagram types are edited as code.

Turn on Manual mode

  1. Open a flowchart, state, sequence, ER, or class diagram.
  2. In the editor’s top bar, switch from Code to Manual.
  3. A toolbar appears at the top left of the canvas, with a line of hints below it. Select something and the hints give way to a bar for it.

How the canvas behaves

  • Drag empty canvas to pan, and scroll or pinch to zoom, as in Code mode. Double-click edits text instead of resetting the view.
  • Esc or a click on empty canvas clears the selection. Delete or Backspace deletes it.
  • Ctrl + Z undoes and Ctrl + Y redoes, like Undo and Redo in the top bar. They work through the code editor, so keep the code panel open (Show code in the top bar).

What happens to your code

Flowcharts and state diagrams keep their arrangement as soon as Manual mode opens: every node’s position goes into one comment line at the end of the code (see Where the arrangement is saved). From then on, the engine, direction, and spacing in the Layout tab don’t move them. Choosing another engine or direction asks whether to arrange the diagram again; Auto layout in the canvas toolbar does the same.

If it doesn’t work

  • Manual is greyed out for other diagram types, such as Gantt charts and mind maps. Edit those as code.
  • The toggle is hidden on narrow screens. Widen the window.
  • “This diagram can’t be edited on the canvas until the code is fixed”: switch back to Code, fix the line the status bar names, and switch again.
Switch from Code to Manual: the toolbar appears, and selecting a node shows its bar.

Arrange

Move things where you want them. Everything you place stays put, and connections follow.

  • Move a node: drag it. It stays where you drop it. With several selected, drag any one of them to move them all.
  • Resize a node: select it, then drag one of its corners.
  • Move a connection label: drag the label. It follows its connection when nodes move. Select the connection and choose Reset position to put it back.
  • Move a node’s text: select the node and drag the small handle under its text. Reset text in the bar puts it back.
  • Move a group’s title: drag it anywhere, inside the group or outside it; it moves with the group. Click the title to select the group, and Reset title puts it back. Groups themselves are added and deleted in the code.
  • Choose the sides a connection uses: select the connection and drag either end to another side of its node (the side it will snap to lights up), or pick them with From and To in the bar: top, right, bottom, or left. Auto lets it choose again.
  • Start again: Auto layout in the canvas toolbar, after asking, forgets every position, size, and label position and lays the diagram out automatically.

Related guides: Edit Mermaid diagrams by dragging, typing, or asking and Use a Mermaid visual editor without losing the source.

Drag a node, resize one by a corner, move a connection label, and attach a connection to another side.

Grow and connect

Build out a flowchart without typing any code.

  1. Select a node. A + appears on each of its sides.
  2. Click a + to add a node connected on that side. It’s placed clear of the others and selected, with its text ready to replace: type, then press Enter.
  3. To connect two nodes, drag a + onto the other node. Drag it onto empty canvas instead to add a connected node right there.

The canvas toolbar

  • Node adds an unconnected node in the middle of the view.
  • Icon node opens the rich node builder and adds the node you build there.
  • Text adds a label with no box, for a note on the diagram.
  • Snippets inserts a saved group of nodes (see Snippets).
Click a + to add a connected node, type its text, then drag a + onto another node to connect them.

Edit and delete

Change what a node or a connection says, and how a node looks, from the bar above the diagram.

  1. Select a node, or double-click it to start typing straight away.
  2. Change it in the bar:
    • Text and Subtitle: type, then press Enter or click away.
    • Status: a coloured light on the node: healthy, warning, error, active, or pending.
    • Shape: rectangle, rounded, stadium, decision, hexagon, database, circle, subroutine, parallelogram, trapezoid, flag, double circle, or text only.
    • Make icon node opens the rich node builder as Make it an icon node: pick an icon, adjust the text, and choose Apply to node (or Use icon only to change just the icon). The node keeps its id, its place, and its connections. On a node with an icon, the button reads Change icon, and the × beside it removes the icon.
  3. To label a connection, click it (or its label), type in Label, and press Enter; double-clicking it starts typing straight away. The bar names the two ends, such as B → C.

Select several and delete

  • Shift-click nodes, or hold Shift and drag a box around them, to select several. Each adds to what’s already selected; Shift-click a selected node to take it out. The bar says how many are selected.
  • Delete, or the bin button in the bar, deletes the selection. Deleting a node deletes its connections too. Undo with Ctrl + Z.
Double-click a node to rename it, then set its subtitle, status, and shape, and label a connection.

Snippets

A snippet is a group of flowchart nodes, with the connections between them and their arrangement, saved by name to insert again in any flowchart.

Save one

  1. In Manual mode, select several nodes (Shift-click them, or Shift-drag a box around them).
  2. Choose Save as snippet in the bar, type a name, and choose Save.

In the code editor, select the lines that define or connect the nodes, choose the bookmark button above the code (Save selection as snippet), name it, and choose Save snippet. Saving with the name of a snippet you already have replaces it.

Insert one

  1. Choose Snippets in the canvas toolbar, or Rich node above the code and then its Snippets tab.
  2. Pick one of Your snippets, or one of the Starters: API, database and cache, CI pipeline, Queue and worker, Sign-in with an identity provider, Event fan-out, Metrics and dashboards.

Its nodes get new ids where yours already use them (api becomes api_2), so nothing merges with your diagram, and they keep their arrangement. In Manual mode they land in the middle of the view, selected, ready to drag into place. Rename or delete a snippet with the buttons on its card; diagrams it was inserted into keep their nodes.

Limits and where they’re kept

  • Signed in, snippets are saved to your account: 5 on Free, 200 on Pro and Pro Max. Past the limit, new ones are kept only in this browser, and the app says so. Signed out, they’re kept in this browser.
  • On Pro and Pro Max, a deleted snippet goes to the Bin for 14 days.
  • Snippets are flowchart nodes, so they can be saved from and inserted into flowcharts only.
Shift-drag a box around nodes, save them as a snippet, then insert it from Snippets in the toolbar.

State diagrams

States and transitions work like nodes and connections in a flowchart.

  • Drag a state to move it, and drag a corner of a selected state to resize it.
  • Click a + beside a selected state to add a connected state, or drag a + onto another state to add a transition. A state added from one inside a composite state goes into that composite.
  • Select a state to rename it in the bar, or delete it. Start and end points and choices have no name; the bar says what they are.
  • Click a transition to label it, choose its sides, or delete it.
  • The toolbar adds a State or a Choice (a branch point). Start and end points ([*]) can be moved and connected like states.

Related guide: Mermaid state diagrams for payment and order lifecycles.

Click a + to add a connected state, name it, and label the new transition.

Sequence diagrams

Mermaid keeps participants in columns and messages in order, so you edit the order and the messages rather than positions. Nothing is added to the code but the messages and participants themselves.

  • Reorder participants: drag one sideways. When the code uses box or create, the order stays as the code has it.
  • Add a message: drag from one participant’s line to another’s, at the height where it belongs. Type its text and press Enter.
  • Move a message: drag it up or down.
  • Edit a message: select it (double-click to type) to change its text and arrow (solid or dotted, a plain line, a cross, async, or both ways), reverse its direction, or delete it.
  • Add a participant: Participant or Actor in the toolbar. Select one to rename it, change its kind (participant, actor, boundary, control, entity, database, collections, or queue), or delete it with its messages.

Notes, loops, and alternatives are edited in the code. If a message uses syntax Manual mode can’t edit yet, the hint line says so; edit it in the code.

Related guide: Mermaid sequence diagrams: a step-by-step tutorial.

Drag a participant to reorder, then drag between two lifelines to add a message and type it.

ER diagrams

  • Move an entity: drag it. Until you move one, Mermaid arranges them; after that, the diagram keeps your arrangement. Auto layout hands it back to Mermaid.
  • Relate two entities: select one and drag a + onto the other (or click a + to add a new related entity). Then, in the bar, pick how many at each end (zero or one, exactly one, zero or more, or one or more), Identifying (solid) or Non-identifying (dashed), and a label. Swap the two ends reverses it.
  • Edit an entity: select it to rename it, add an Attribute, or delete it with its relationships.
  • Edit an attribute: click its row to change its type, name, or comment, mark it PK, FK, or UK, or move it up or down.
  • The toolbar adds an Entity. Comments, blank lines, and styling in the code stay as they are.

Related guides: Edit a Mermaid ER diagram on the canvas in Manual mode and the ER relationship cheat sheet.

Drag an entity, add an attribute and mark it, then change how many are at one end of a relationship.

Class diagrams

  • Move a class: drag it. Until you move one, Mermaid arranges them. Notes stay where they are, and Auto layout hands the arrangement back to Mermaid.
  • Relate two classes: select one and drag a + onto another (or click a + to add a related class). Pick the kind: inheritance, realization, composition, aggregation, association, dependency, link, or dashed link. Add a multiplicity at each end (such as 1 or *) and a label, or reverse it.
  • Edit a class: select it to rename it, set a stereotype (interface, abstract, enumeration, …), add an Attribute or a Method, or delete it with its relationships.
  • Edit a member: click it to change its visibility (public, private, protected, or package), its text (Type name, or name(parameters) ReturnType for a method), or whether it’s static or abstract, or to move it up or down.
  • The toolbar adds a Class.

Related guide: Mermaid class diagrams for interfaces and ownership.

Drag a class, add a method to another, and change the kind of a relationship.

Where the arrangement is saved

Positions, sizes, moved labels and titles, and connection sides are saved in one comment line at the end of the code (%% flowgraph-layout: …). Other Mermaid tools ignore it and lay the diagram out automatically; in Flowgraph Studio, exports, the API, and shared links all keep your arrangement. To return to automatic layout for good, switch to Code and delete the line, or choose Arrange automatically in the Layout tab. Auto layout in Manual mode arranges the diagram afresh, then saves that arrangement. Flowcharts and state diagrams get the line when Manual mode opens; ER and class diagrams once you move an entity or a class. Sequence diagrams need none: their changes are all in the code.