JavaScript diagram libraries

Updated Nov 2026

JavaScript diagram libraries draw flowcharts, network graphs, and process diagrams in the browser. A diagram library keeps a model of nodes and the edges between them, then lays that model out and renders it as SVG or canvas. These libraries draw the flowcharts in documentation, the process editors in business apps, and the network maps in analysis tools.

Popularity

cytoscape has the most monthly downloads in this comparison, at 100.3M.

LibraryMonthly downloadsStarsLast releaseLicense
cytoscape
100.3M
11.3KNov 2026MIT
mermaid
98.9M
91.1KNov 2026MIT
@viz-js/viz
1.9M
4.4KSep 2026MIT
bpmn-js
1.8M
9.7KNov 2026bpmn.io license
@antv/g6
1.2M
12.4KMay 2026MIT
GoJS
1.1M
8.5KOct 2026Commercial
maxGraph
519.0K
1.2KOct 2026Apache-2.0
@antv/x6
368.9K
6.8KAug 2026MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Builds interactive graph visualizations with selectors, layouts, and graph operations.

Downloads / mo
100.3M
Stars
11.3K
Last release
3.35.0
License
MIT

Strengths

  • Positions graph nodes automatically. Use layouts to arrange nodes instead of assigning every position.
  • Styles graph elements with selectors. Apply graph styles using familiar CSS conventions.

Limitations

  • Image export needs a renderer. Headless graph instances cannot export the currently rendered graph image.
  • Styles ignore CSS specificity. When selectors overlap, the last matching selector wins.

Quickstart

From getting-started.md
$ npm install cytoscape
import cytoscape from 'cytoscape';

const cy = cytoscape({
  container: document.getElementById('cy'),
  elements: [
    { data: { id: 'a' } },
    { data: { id: 'b' } },
    { data: { id: 'ab', source: 'a', target: 'b' } },
  ],
  layout: { name: 'grid', rows: 1 },
});

cytoscape examples

From open-source projects on GitHub

Renders text descriptions into diagrams and visualizations.

Downloads / mo
98.9M
Stars
91.1K
Last release
12.3.0
License
MIT

Strengths

  • Keeps diagrams in text. Update the diagram description to change the rendered result.
  • Themes individual diagrams. Apply themes across a site or to individual diagrams.

Limitations

  • Clicks disabled by default. The default strict security mode disables node click interactions.
  • Custom colors need base theme. Use the base theme when changing theme variables.

Quickstart

From usage.html
$ npm install mermaid
import mermaid from 'mermaid';

mermaid.initialize({ startOnLoad: false });
const { svg } = await mermaid.render('example', 'graph LR; A-->B;');
document.getElementById('diagram').innerHTML = svg;

mermaid examples

From open-source projects on GitHub

Renders Graphviz diagrams through a WebAssembly build and JavaScript wrapper.

Downloads / mo
1.9M
Stars
4.4K
Last release
3.31.0
License
MIT

Strengths

  • Accepts DOT or graph objects. Pass DOT text or construct a graph object in JavaScript.
  • Reuses the rendering instance. Render additional graphs without creating another rendering instance.

Limitations

  • Render failures need status checks. The render method returns failures without throwing for invalid DOT syntax.

Quickstart

From viz-js.com
$ npm install @viz-js/viz
import * as Viz from "@viz-js/viz";

Viz.instance().then(viz => {
  const svg = viz.renderSVGElement("digraph { a -> b }");

  document.getElementById("graph").appendChild(svg);
});

@viz-js/viz examples

From open-source projects on GitHub

Views and edits BPMN 2.0 process diagrams in the browser.

Downloads / mo
1.8M
Stars
9.7K
Last release
18.33.0
License
bpmn.io license

Strengths

  • Views and edits BPMN diagrams. Import BPMN XML and edit the process in the browser.

Limitations

  • The watermark must stay visible. The license forbids removing or covering the bpmn.io watermark on rendered diagrams.

Quickstart

From Modeler.d.ts
$ npm install bpmn-js
import Modeler from 'bpmn-js/lib/Modeler';
import 'bpmn-js/dist/assets/diagram-js.css';
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';

const modeler = new Modeler({ container: '#canvas' });
await modeler.createDiagram();

bpmn-js examples

From open-source projects on GitHub

Draws interactive graph visualizations in JavaScript.

Downloads / mo
1.2M
Stars
12.4K
Last release
5.1.1
License
MIT

Strengths

  • Ships built-in graph layouts. Arrange nodes with a built-in layout or a custom one.
  • Ships built-in interactions. Turn on built-in interaction behaviors and listen to graph events.

Quickstart

From graph.d.ts
$ npm install @antv/g6
import { Graph } from '@antv/g6';

const graph = new Graph({
  container: 'container',
  data: { nodes: [{ id: 'node-1', style: { x: 100, y: 100 } }] },
});
await graph.render();

Builds interactive diagram editors with templates, models, and layouts.

Downloads / mo
1.1M
Stars
8.5K
Last release
4.0.5
License
Commercial

Strengths

  • Includes interactive editing tools. Users can select, drag, copy, delete, pan, and zoom diagram elements.
  • Includes automatic graph layouts. Choose built-in layouts for trees, force-directed graphs, and layered diagrams.

Limitations

  • Organizations need a commercial license. Organizational use requires a purchased license beyond private evaluation.
  • SVG exports lose interactivity. Exported SVG images are static, unlike the interactive diagram.

Quickstart

From README.md
$ npm install gojs
import * as go from 'gojs';

const diagram = new go.Diagram('myDiagramDiv');
diagram.nodeTemplate = new go.Node('Auto').add(
  new go.TextBlock().bind('text', 'key'),
);
diagram.model = new go.GraphLinksModel(
  [{ key: 'Alpha' }, { key: 'Beta' }],
  [{ from: 'Alpha', to: 'Beta' }],
);

maxGraph

Builds diagrams entirely on the client and renders them with SVG and HTML.

Downloads / mo
519.0K
Stars
1.2K
Last release
0.25.1
License
Apache-2.0

Strengths

  • Edits vertices and edges. Resize, move, and rotate shapes, then arrange them with automatic layouts.
  • Reads mxGraph XML. Load diagrams saved in the mxGraph XML format.

Quickstart

From README.md
$ npm install @maxgraph/core
import { Graph } from '@maxgraph/core';
import '@maxgraph/core/css/common.css';

const graph = new Graph(document.getElementById('graph'));
graph.batchUpdate(() => {
  graph.insertVertex({
    parent: graph.getDefaultParent(),
    value: 'Hello',
    position: [20, 20],
    size: [80, 30],
  });
});

Builds diagram editors that render with SVG and HTML.

Downloads / mo
368.9K
Stars
6.8K
Last release
3.1.8
License
MIT

Strengths

  • Exports SVG and images. Export a graph as SVG, PNG, or JPEG through the Export plugin.

Limitations

  • Export needs a plugin. SVG and image export load through the separate Export plugin.

Quickstart

From graph.d.ts
$ npm install @antv/x6
import { Graph } from '@antv/x6';

const graph = new Graph({
  container: document.getElementById('graph'),
  width: 600,
  height: 400,
});
graph.addNode({
  shape: 'rect', x: 40, y: 40, width: 80, height: 40,
  attrs: { label: { text: 'Hello' } },
});

FAQ

Mermaid is a JavaScript tool that renders diagrams, charts, and visualizations from a Markdown-based text syntax. Update the diagram description to change the rendered result.

GoJS is a JavaScript and TypeScript library for creating and manipulating diagrams, charts, and graphs. Organizational use requires a purchased license beyond private evaluation.

maxGraph and @antv/x6 build editable diagrams in the browser with SVG and HTML rendering. bpmn-js covers BPMN process diagrams.

Mermaid compiles its own Markdown-based diagram languages to SVG, while Viz.js renders Graphviz DOT text through a WebAssembly build of Graphviz.

Cytoscape.js is a graph theory library for network analysis and visualization, with layouts that position nodes automatically.

The render method returns failures without throwing for invalid DOT syntax.

For coding agents

Found your diagram library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official