Back

VibeFox JS Diagram — Demo

Quick start

Plain HTML

The flowchart of the quick start with the shape palette on the left. Drag a shape from the palette onto the diagram, drag a node, draw an edge from a port of a node, double-click a node to edit its label.

Core concepts

Events

Every event handler receives one payload object; the list under the diagram shows the latest events. Click, move and connect nodes, edit a label or zoom with the mouse wheel.

State snapshots

getState() keeps the zoom, the pan, the selection and the geometry of every node; setState() restores them. Click Save view, move some nodes and zoom, then click Restore view.

Undo and redo

Every edit is one undo step; the buttons follow the event historyChange. Move or delete a node, then undo and redo (also Ctrl+Z and Ctrl+Y).

Nodes and edges

Editing from code

The node Code review was added, recolored, resized, rotated and connected from code. Click Add a step to add a node connected to the last one.

User interaction

The node Ship is selected: drag its square handles to resize it and the round handle to rotate it (Shift snaps the angle). Drag nodes along the snapping grid with alignment guides, draw a new edge from a port, select an edge and drag its ends to reconnect it.

Arranging

Five nodes placed at random are selected. Align them, spread them evenly, or select some yourself (Shift+click or a marquee on the background) and arrange those.

Edges, routers and arrows

The three routers (straight, bezier, ortho going around the node in the middle) and a set of arrow heads, ER ends included. Drag the node Obstacle and watch the orthogonal edge go around it.

Shapes, templates and shape sets

Built-in shapes and templates

The built-in shapes and two nodes drawn by an HTML template from their data ({{data.name}}, the fill bound to data.color). Hover a person card to see its tooltip.

Your own shapes

Two shapes added with registerShape(): a tag and a star, each an SVG path of the node size. Resize a node: the outline follows the new size.

Shape sets

A BPMN 2.0 process from the bpmn shape set, with the palette of the BPMN, UML and ER sets on the left. Drag a BPMN shape into the pool and connect it.

UML classes with inheritance and composition (kind: 'uml:inheritance' sets the arrow and the line) and ER entities with crow's foot ends.

A network diagram from the network set: devices with icons, links and a VPN line.

Containers

Two swimlanes and a group: the children move with their container, and the container grows when a child is dragged to its border. Click Collapse / expand to fold the group.

Layouts

One graph and the automatic layouts. Pick a layout and a direction: the nodes move to their new places with an animation (one undo step).

Viewport

A larger graph with the minimap in the corner. Zoom with the mouse wheel or the buttons, drag the background to pan, drag the frame in the minimap, or center the view on one node.

Editing tools

Palette

The searchable shape palette with the built-in items and two own items. Type in the search field, then drag an item onto the diagram.

Property inspector and node toolbar

The inspector on the right shows the properties of the selected node, with an own field Owner; the node toolbar is beside the node. Change the label, the colors or the owner; select an edge to change its router and arrows.

Context menu and tooltips

The context menu of the node Order valid? with an own item at the end. Right-click a node, an edge or the background for their menus; hover a node for its tooltip.

Analysis tools

Everything reachable from Start is highlighted (traceFlow). Check the diagram with the linter (a node without connections, a duplicate edge) or show the changes against the previous version.

Process simulation

Tokens run through the process; a step with a long queue is marked as a bottleneck. Pause, step, change the speed or start again; the list under the diagram shows the slowest steps at the end.

Import and export

Diagram files

The Mermaid text in the box was imported and laid out. Edit it and click Import, or pick a format and click Export to see the diagram as Mermaid, BPMN 2.0 XML, GraphML, draw.io or JSON.

Images, PDF and printing

The buttons download the diagram as SVG, PNG (2×), JSON or a vector PDF on an A4 page, or open the print dialog. The files are made in the browser.

Large graphs

5 000 nodes and 4 900 edges made in the code. At this zoom the canvas level of detail draws simplified shapes; zoom in with the wheel and the nodes become SVG again, only the visible ones are drawn.

Collaboration

Two participants, Ann (left) and Ben (right), joined by a small in-page transport that stands for your WebSocket. Move, add or rename a node on one side: it changes on the other; the selection and the cursor of the other participant are shown.

Text to diagram and explanations

The diagram was built from the text in the box by the built-in rules (no language model); under it is the text of explain(). Change the text — arrows like A -> B or simple sentences — and click Build.

Theming and styling

Themes

Pick a theme in the list above the diagram: the built-in light, dark and high-contrast, or a theme of the pack (vibefox-js-themes.css linked).

CSS variables

The node fill, the edge width and color, the grid dots and the selection color of this diagram changed with CSS variables on its element.

Ready-made styles

Pick one of the five ready-made styles in the list: flowchart, bpmn, org, blueprint or sketch. The nodes have kinds (start, decision, process), the edges yes / no.

Density and size

The same diagram with the palette at three densities set on the container. Pick compact, normal or comfortable: the palette, the ports and the handles change their size.

Your own CSS

Own CSS rules beat the library rules without !important (they are in @layer vfjs): nodes of the kind risk are red, and all labels are bold.

Localization and RTL

Languages

The diagram in Russian: load the language pack vibefox-js-diagram.ru.js after the library and set locale: 'ru'. The palette and the context menu are translated, the labels are your data.

Adding a language

A partial German dictionary added with addLocale(): the translated palette texts are German, the missing keys fall back to English.

Right-to-left

The option rtl: true with Hebrew labels: the drawing is not mirrored, the UI around it is — the minimap is on the left and the context menu opens to the left. Every label keeps the direction of its own text, so Latin and mixed labels (Order valid?, API v2) read correctly too.

Accessibility

Keyboard

The node Order valid? has the keyboard focus ring. Click the diagram and use Tab, Alt+arrows, the arrows to move a node, Enter to edit, C to connect.

AI tools

The tool loop with a stand-in model function in the code (your model goes there): it asks for the tool diagram_apply_operations, and the step Testing is added after Review. Click Ask again for one more step, or Explain to call diagram_explain.

Bug Report

Thank you for helping us improve. We carefully review every report, but we do not reply to them individually. If your report leads to a change, it will be listed in the product changelog together with the report number. To discuss something in detail, please open a support ticket.

Slide to fit the puzzle