Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

A simple MermaidDiagram component for Blazor.

License

Notifications You must be signed in to change notification settings

Dackerness/MermaidJS.Blazor

Open more actions menu
 
 

Repository files navigation

MermaidJS.Blazor

A simple MermaidDiagram component for Blazor.

For more information on MermaidJS including the diagram definition syntax, JavaScript API, or other supported features, please visit: https://mermaid-js.github.io/.

Getting Started

1. Install the MermaidJS.Blazor NuGet package.

> dotnet add package MermaidJS.Blazor

2. Add builder.Services.AddMermaidJS() to your Program.cs.

using Microsoft.Extensions.DependencyInjection;

// ... //

builder.Services.AddMermaidJS();

NOTE: You do not need to include mermaid.js or mermaid.min.js in your index.html. MermaidJS.Blazor will load the library on demand at runtime.

3. Use the MermaidDiagram component in your app.

@using MermaidJS.Blazor

<!-- ... -->

<MermaidDiagram Definition="@diagramDefinition" OnClick="OnClickNode" />

@code
{
    string diagramDefinition = "graph TB\nA-->B";

    void OnClickNode(string nodeId)
    {
        // TODO: do something with nodeId
    }
}

Handling Node Clicks

To raise node click events back to your blazor component, set your click callback to onClickMermaidNode:

graph TB
A--B
click A onClickMermaidNode
Loading

About

A simple MermaidDiagram component for Blazor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 52.4%
  • JavaScript 23.9%
  • HTML 23.7%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.