The <workflow-render> web component

<script type="module" crossorigin="anonymous"
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/element/workflow-render.js"
  integrity="sha384-ba9lOQoTmpSwduU3wioJbE1KpVWlVt5wqBjjddDBM07c379jh8wQtkykrmlsvu6t"></script>

<div style="width: 100%; height: 600px">
  <workflow-render src="./workflows/invoice-sync.json"></workflow-render>
</div>

The element fills the box you give it. It has no border or padding of its own. The script is 52 KB gzipped.

Loading it

OptionHow
CDNThe <script> tag above. Pin the version and keep the integrity hash
Self-hostedCopy the whole node_modules/workflow-render/dist/element/ folder. The script loads its icon, description and font files from beside itself
Bundlerimport 'workflow-render/element' registers the element, with types

src is fetched by the visitor's browser, so the JSON must be same-origin or served with CORS headers.

Note

If your site sends a Content-Security-Policy header, the inspector needs style-src-attr 'unsafe-inline'. It sets inline style attributes. Scripts and <style> blocks are not affected.

Attributes

AttributeMeaningDefault
srcURL of a workflow or execution JSON. The kind is detected
workflowInline JSON string, or an object through the property. Takes precedence over src
executionA separate execution JSON, when workflow and run are two files
zoomfit or a numberfit
staticRender without interaction, for thumbnailsfalse
inspectorpanel or offpanel
exportuion or off. Shows the SVG and PNG buttonson
imagessafe or remote. Whether sticky-note images may load from another hostsafe
emulatesRead-only. The bundled n8n version

Events and methods

EventDetail
wr-load{ view, warnings }
wr-error{ message }
wr-node-click{ nodeName }. Fires on a single click, whether or not the inspector is on
wr-inspector-open{ nodeName }
wr-inspector-close
MethodReturns
exportSvg()Promise<string>

Pan and zoom

With a mouse or trackpad, the gestures are n8n's own:

InputAction
Wheel, or two-finger scrollPan
Ctrl or Cmd + wheel, or trackpad pinchZoom about the pointer
Middle-button drag, or Space + dragPan
DragDraw a selection rectangle
Click on a nodeSelect it. Shift + click adds to the selection
Double-click on a nodeOpen the inspector
Double-click on the canvasZoom 2×
0Reset zoom
1Fit to view
+ / -Zoom in and out

On a touch screen:

InputAction
One-finger dragPan
PinchZoom
Tap on a nodeOpen the inspector

The buttons in the corner fit the view and zoom in and out on any device.

Keyboard shortcuts only fire while the element has focus, so it never takes keystrokes from the page around it.

The inspector

Double-click a node, or tap it on a touch screen, to open a read-only panel with three tabs: Parameters, Settings and JSON.

For an execution, the panel also shows what the node received and what it produced.

The panel adapts to the space the element is given. In a wide container, Input, the node and Output sit side by side. Below 760 pixels it shows one at a time, with a switch at the top.