diagram-sankeyMermaid

Create interactive diagrams and flowcharts using text-based Mermaid syntax for visualizing laboratory workflows, processes, and experimental designs

Overview

The Mermaid section widget enables laboratory professionals to create and embed interactive diagrams directly within Labii records using text-based syntax. Built on the powerful Mermaidarrow-up-right JavaScript library, this widget transforms simple text descriptions into professional-quality diagrams, including flowcharts, sequence diagrams, Gantt charts, class diagrams, and more. The widget is particularly valuable for documenting experimental workflows, process flows, project timelines, and system architectures without requiring specialized diagramming software. With integrated AI assistance, users can generate complex diagrams from natural language descriptions, making diagram creation accessible to both technical and non-technical laboratory staff.

Use Cases

  • Experimental Protocol Visualization: Create flowcharts documenting step-by-step experimental procedures with decision points and conditional branches

  • Laboratory Workflow Mapping: Design process flow diagrams showing sample handling, testing sequences, and quality control checkpoints

  • Project Timeline Management: Build Gantt charts for research projects, showing task dependencies and milestone tracking

Interface

Read-only View

The read-only view displays the rendered diagram in its final visual form. Users can view the complete diagram with all formatting, colors, and styling applied according to the selected theme. The diagram is fully interactive, allowing users to zoom and pan when viewing complex or large diagrams. Any hyperlinks embedded within diagram elements are clickable, enabling navigation to related documentation or external resources. The view automatically scales diagrams to fit within the section container while maintaining aspect ratio and clarity.

Edit View

The edit view provides a split-screen interface with a text editor on the left and a live preview pane on the right. As users type or modify the Mermaid syntax, the preview updates in real-time, allowing immediate visualization of changes. The text editor includes syntax highlighting for Mermaid code, making it easier to identify diagram elements, relationships, and formatting directives.

Key features of the edit interface include:

  • Code Editor: Write or edit Mermaid syntax with line numbering and basic text editing capabilities

  • Live Preview: Real-time rendering of diagrams as you type, showing exactly how the final diagram will appear

  • AI Assistant: Access AI-powered diagram generation through a dedicated button, allowing natural language description of desired diagrams

  • Theme Selection: Choose from multiple visual themes (Default, Forest, Dark, Neutral) to match documentation style or organizational branding

  • Insert/Replace Controls: When using AI generation, choose to insert generated code at cursor position or replace existing content entirely

  • Syntax Validation: Automatic detection of syntax errors with helpful error messages to guide corrections

The editor supports all standard text editing operations including copy, paste, undo, and redo, making it easy to iterate on diagram designs and incorporate feedback.

Configuration

circle-info

The Mermaid widget requires minimal configuration to use. Most users can start creating diagrams immediately after adding the widget to a section.

Adding the Mermaid Widget

1

Navigate to the record where you want to add a diagram and click Add Section

2

Select Mermaid from the section widget options

3

Click Edit to open the diagram editor and begin creating your diagram

Creating a Basic Diagram

1

In the edit view, enter your Mermaid syntax in the text editor. For a simple flowchart:

2

Select your preferred theme from the theme dropdown:

  • Default: Clean, minimalist styling with blue accents

  • Forest: Green color palette suitable for environmental or biological documentation

  • Dark: High contrast dark theme for presentations or reduced eye strain

  • Neutral: Grayscale professional styling for formal documentation

3

Click Submit to save the diagram. The rendered diagram will display in read-only view

Using AI Assistant to Generate Diagrams

1

Click the AI Assistant button in the diagram editor

2

Describe your desired diagram in natural language. Example: "Create a flowchart showing a protein purification workflow with centrifugation, column chromatography, and quality control steps"

3

Press Enter to submit your prompt

4

Review the AI-generated Mermaid code in the preview pane. The AI will create syntactically correct Mermaid code based on your description

5

Choose your insertion method:

  • Click Insert to add the generated code at the current cursor position

  • Click Replace to replace all existing diagram code with the generated version

6

Refine the generated code as needed and select your preferred theme

7

Click Submit to save the completed diagram

circle-check

Additional Functions

Supported Diagram Types

The Mermaid widget supports all diagram types available in the Mermaid library:

Flowcharts

Standard directed graph diagrams for representing processes, decisions, and workflows. Supports multiple orientations (top-down, left-right, bottom-up) and various node shapes (rectangles, rounded rectangles, circles, diamonds, hexagons).

Documentation: https://mermaid-js.github.io/mermaid/#/flowchartarrow-up-right

Sequence Diagrams

Interaction diagrams showing how processes, systems, or objects communicate with one another and in what order. Ideal for documenting system integrations, API interactions, and multi-step automated workflows.

Documentation: https://mermaid-js.github.io/mermaid/#/sequenceDiagramarrow-up-right

Class Diagrams

Object-oriented modeling diagrams showing system structure, class relationships, and data models. Useful for documenting software architecture, database schemas, and data relationship models.

Documentation: https://mermaid-js.github.io/mermaid/#/classDiagramarrow-up-right

State Diagrams

Diagrams describing system behavior through finite states and transitions. Excellent for documenting equipment states, sample lifecycle stages, and process control logic.

Documentation: https://mermaid-js.github.io/mermaid/#/stateDiagramarrow-up-right

Gantt Charts

Project schedule visualizations showing task timelines, dependencies, and milestones. Essential for research project planning, resource allocation, and deadline tracking.

Documentation: https://mermaid-js.github.io/mermaid/#/ganttarrow-up-right

Pie Charts

Circular statistical graphics displaying numerical proportions. Useful for visualizing resource allocation, sample composition, or categorical data distributions.

Documentation: https://mermaid-js.github.io/mermaid/#/piearrow-up-right

circle-info

Additional diagram types including entity relationship diagrams, user journey maps, and Git graphs are also supported. Check the Mermaid documentation for the complete list of available diagram types.

References

Official Mermaid Resources

Diagram Type References

Last updated