npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mermaid-reactflow-render

v0.5.1

Published

Render Mermaid flowcharts as interactive React Flow diagrams. A render-only library (no editor) inspired by mermaid-reactflow-editor.

Downloads

1,459

Readme

mermaid-reactflow-render

Render Mermaid flowcharts as interactive React Flow diagrams. This is a render-only library — it converts Mermaid flowchart/graph source into laid-out React Flow nodes and edges and draws them. There is no editor.

The conversion approach and visual styling are inspired by and adapted from the MIT-licensed mermaid-reactflow-editor by albingcj — this package extracts and reimplements just the rendering half.

Sample flowchart rendered horizontally (LR) with mermaid-reactflow-render

Install

npm install mermaid-reactflow-render @xyflow/react react react-dom

@xyflow/react (React Flow 12), react, and react-dom are peer dependencies — this library is a React Flow plugin and intentionally shares the host app's single React Flow instance rather than bundling its own. @dagrejs/dagre (used internally for layout) ships as a regular dependency, so you don't need to install it.

Usage

import { MermaidFlow } from "mermaid-reactflow-render";
import "mermaid-reactflow-render/styles.css";

const code = `flowchart TD
  A([Start]) --> B{Decision?}
  B -->|Yes| C[Do the thing]
  B -->|No| D[Skip]
  C --> E((Done))
  D --> E`;

export default function App() {
  return (
    <div style={{ width: "100%", height: 600 }}>
      <MermaidFlow code={code} />
    </div>
  );
}

The component fills its parent, so give the wrapper an explicit size.

Props

| Prop | Type | Default | Description | | ---------------- | --------------------- | ------- | ------------------------------------------------------ | | code | string | — | Mermaid flowchart source. | | nodes / edges| Node[] / Edge[] | — | Pre-computed elements (overrides code). | | showControls | boolean | true | Bottom-left zoom / fit controls. | | showBackground | boolean | true | Dotted background grid. | | direction | "TB"|"BT"|"LR"|"RL" | — | Force layout direction, overriding the source. | | fitView | boolean | true | Fit the diagram to the viewport on mount. |

Horizontal vs. vertical layout

By default the layout follows the direction declared in the Mermaid source (flowchart TD, flowchart LR, …). You can override it with the direction prop — "LR"/"RL" lay the flow out horizontally, "TB"/"BT" vertically:

<MermaidFlow code={code} direction="LR" />

The same override is available on the converter: convertMermaidToReactFlow(code, { direction: "LR" }).

All other React Flow props are forwarded.

Converting without rendering

import { convertMermaidToReactFlow } from "mermaid-reactflow-render";

const { nodes, edges } = convertMermaidToReactFlow(code);

Supported Mermaid syntax

  • Directions: TB / TD, BT, LR, RL
  • Node shapes: [rect], (round), ([stadium]), ((circle)), {diamond}
  • Edge labels: A -->|label| B and A -- label --> B
  • Edge styles: -->, ---, -.->, ==>
  • Multi-line labels with <br/>
  • Subgraphs (including nested) with per-subgraph direction

Development

npm install
npm run dev          # playground at http://localhost:5180
npm test             # unit + component tests (vitest)
npm run test:e2e     # Playwright visual/e2e tests
npm run build        # build the publishable library into dist/

License

MIT — see LICENSE. Includes attribution to the original mermaid-reactflow-editor project.