Skip to main content

Expanding the Horizons of Mermaid Flowcharts: Introducing 30 New Shapes!

·5 mins

Discover 30 new shapes in Mermaid flowcharts, offering enhanced clarity, customization, and versatility for more dynamic and expressive visualizations.

Mermaid fans, get ready! We’re thrilled to announce that we have introduced 30 brand-new shapes to Mermaid flowcharts. This significant upgrade takes the flexibility and depth of flowchart creation to a whole new level. Whether you are mapping out complex workflows or crafting simple diagrams, these new shapes will bring precision and style to your flowcharts.

These new additions are more than just aesthetically pleasing. Introducing these new shapes improves visual clarity by helping to distinguish various types of processes, actions, or statuses, making flowcharts easier to read and understand, especially for those unfamiliar with the workflow. Each shape can carry a specific semantic meaning, allowing closer alignment between the visual representation and its actual function. For example, the “database” shape signifies data storage, while the “manual input” shape indicates an action requiring human intervention. With more options, users have greater flexibility to customize their flowcharts, mixing and matching shapes to suit specific audiences. Additionally, these new shapes increase the versatility of Mermaid flowcharts, allowing them to represent a wide array of scenarios, from simple processes to complex systems, across fields such as business, IT, and project management.

Syntax Simplification and Challenges #

One of the major challenges we faced when adding these new shapes was designing a robust and easy-to-remember syntax. Mermaid’s syntax already allows for shorthand notations, but we realized that a new approach was required with an increasing number of shapes. There are only so many combinations of parenthesis and brackets you can remember.

Instead of relying solely on shorthand, we’ve introduced a general syntax structure that adds data directly to the shape using this format:

A@{ shape: rect }@

This syntax creates a shape with ID A represented as a rectangle. It renders just as A["A"] would, but offers the flexibility to define additional attributes such as custom shapes. You can add the label attribute to set the label. One thing to note is that the shape attribute wins over the shorthand, making it possible to use the shorthand for the label and add the shape using the attributes like this A[A label]@{ shape: doc }@.

New Shapes Overview #

Here’s a sneak peek at the new shapes and how you can use them to improve your Mermaid flowcharts:

The following table is just a tiny taste of what the new shapes offer. Each shape has a clear semantic meaning, from cylinders representing databases to trapezoids indicating manual processes. Whether you’re displaying data flow, decision branches, or workflow automation steps, these additions allow you to capture every nuance.

Semantic Name Shape Name Short Name Description Alias Supported
Process Rectangle rect Standard process shape proc, process
Event Rounded Rectangle rounded Represents an event event
Terminal Point Stadium stadium Terminal point term, pill
Subprocess Framed Rectangle fr Subprocess subproc, framed-rectangle
Database Cylinder cyl Database storage db, cylinder
Start Circle circle Starting point
Odd Odd odd Odd shape
Decision Diamond diam Decision-making step decision, diamond
Prepare Conditional Hexagon hex Preparation or condition step hexagon, prepare
Data Input/Output Lean Right l-r Represents input or output lean-right, in-out
Data Input/Output Lean Left l-l Represents output or input lean-left, out-in
Priority Action Trapezoid Base Bottom trap-b Priority action priority, trapezoid-bottom
Manual Operation Trapezoid Base Top trap-t Represents a manual task manual, trapezoid-top
Stop Double Circle dc Represents a stop point double-circle
Text Block Text Block text Text block -
Card Notched Rectangle notched-rect Represents a card card, notch-rect
Lined/Shaded Process Lined Rectangle lined-rect Lined process shape lined-proc
Start Small Circle sm-circ Small starting point start, small-circle
Stop Framed Circle framed-circle Stop point stop, framed-circle
Fork/Join Long Rectangle fork Fork or join in process flow join, long-rect
Collate Hourglass hourglass Represents a collate operation -
Comment Curly Brace brace Adds a comment comment, brace-l
Comment Right Curly Brace brace-r Adds a comment -
Comment with braces on both sides Curly Braces braces Adds a comment -
Com Link Lightning Bolt bolt Communication link com-link, lightning-bolt
Document Wave-Edged Rectangle we-rect Represents a document doc, wave-edge-rect
Delay Half-Rounded Rectangle delay Represents a delay half-rounded-rect
Direct Access Storage Tilted Cylinder t-cyl Direct access storage das, tilted-cylinder
Disk Storage Lined Cylinder l-cyl Disk storage disk, lined-cylinder
Display Curved Trapezoid cur-trap Represents a display disp, curved-trapezoid
Divided Process Divided Rectangle div-rect Divided process shape div-proc, divided-rectangle
Extract Small Triangle sm-tri Extraction process extract, small-triangle
Internal Storage Window Pane win-pane Internal storage internal-storage, window-pane
Junction Filled Circle fc Junction point junction, filled-circle
Lined Document Lined Wave-Edged Rectangle lin-we-rect Lined document lin-doc, lined-wave-edged-rect
Loop Limit Trapezoidal Pentagon not-pent Loop limit step loop-limit, notched-pentagon
Manual File Flipped Triangle flip-tria Manual file operation manual-file, flipped-triangle
Manual Input Sloped Rectangle sloped-rect Manual input step manual-input, sloped-rectangle
Multi-Document Multi-Wave-Edged Rectangle mul-we-rect Multiple documents mul-doc, multi-wave-edged-rectangle
Multi-Process Multi-Rect mul-rect Multiple processes mul-proc, multi-rect
Paper Tape Flag flag Paper tape paper-tape, ``
Stored Data Bow Tie Rectangle bt-rect Stored data stored-data, bow-tie-rect
Summary Crossed Circle cross-circle Summary summary, crossed-circle
Tagged Document Tagged Wave-Edged Rectangle tag-we-rect Tagged document tag-doc, tagged-wave-edged-rectangle
Tagged Process Tagged Rectangle tag-rect Tagged process tag-proc, tagged-rect

Example Usage #

flowchart RL
    subgraph "Main Process"
        A[File Handling]@{ shape: manual-file}@
        B5[User Input]@{ shape: manual-input}@
        C5[Multiple Documents]@{ shape: mul-doc}@
        D5[Process Automation]@{ shape: mul-proc}@
        E5[Paper Records]@{ shape: paper-tape}@
    end
    subgraph "Additional Process"
        A2@{ shape: fork, label: "Parallel Processing"}@
        B2@{ shape: hourglass, label: "Timed Operation"}@
        C2@{ shape: comment, label: "Note: User Intervention Required" }@
    end

This example shows a flowchart that uses several new shapes, such as manual-file, manual-input, and mul-doc, making the chart more expressive and accessible to follow. It also shows how labels can be added using shorthand notation or as attributes.

Closing Thoughts #

These new shapes give Mermaid flowchart creators great control over their diagrams. Whether you’re dealing with simple workflows or complex processes, these shapes will provide greater depth and clarity to your visualizations. Happy charting!

If you’re excited about this new update or have any questions, please share your thoughts. You can try the shapes today at https://www.mermaidchart.com/play or wait for the official Mermaid release in September 2024.