Skip to content
Calm motion: animations on this site only fade, with no movement

NodeGraph ​

Boxes you drag and link: a pipeline, a flow, a dependency map

An editable diagram: nodes the reader places, and arrows they draw between them. Use it where the relationships are the content: a build pipeline, an automation, a lesson order. For a fixed hierarchy that is only displayed, use OrgChart. For tasks on a calendar, Gantt. It sits on InfiniteCanvas, so the whole diagram pans and zooms.

Pipeline
Source
Lint
Test
Ship

Source → Lint, Source → Test, Lint → Ship

  • Every node has one input (left) and one output (right). Drag a node to move it (snap keeps it on a grid). pull from the output square onto another node to link them. Click an arrow to select it and press Delete to remove it.
  • Keyboard: focus a node (one is in the tab order). The arrows move it (Shift: further). L starts a link, then the arrows choose the target. Enter links, or unlinks if they are already linked. Esc cancels, and Delete removes the node and its links. Each step is announced, and every node is named with what it connects to.
  • acyclic refuses a link that closes a loop. Self-links and duplicates are always refused, and the refusal is announced.
  • The state is yours: v-model:nodes ({ id, x, y, label }), v-model:edges ({ from, to }), v-model:selected and v-model:view. connect, disconnect, move and remove events say what changed.
  • Nodes are nodeWidth × nodeHeight (160 × 56) so links can find their ports. The #node="{ node, selected }" slot draws something richer inside that box. :editable="false" shows and selects but changes nothing.

Usage ​

ts
import { BlessNodeGraph } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
nodeWidthnumber160size used for ports and links; put content that fits it in the `#node` slot
nodeHeightnumber56
snapnumber0snap dragged nodes to this grid, px; 0 is free
acyclicboolean—refuse a link that would close a loop
editablebooleantrueoff: nodes can be selected and the view moved, nothing is dragged, linked or removed
gridbooleantrue
controlsbooleantrue
minZoomnumber—
maxZoomnumber—
labelstring"Graph"
labelsPartial<{ node: (label: string, to: string[], from: string[]) => string; linkFrom: (from: string) => string; linkTo: (from: string, to: string, exists: boolean) => string; linked: (from: string, to: string) => string; unlinked: (from: string, to: string) => string; refused: (from: string, to: string, why: "self" | "exists" | "cycle") => string; cancelled: string; removed: (label: string) => string; hint: string; }>—
nodesBlessGraphNode[][]
edgesGraphEdge[][]
selectedstring | nullnull
viewCanvasView{ x: 0, y: 0, zoom: 1 }

Events

NamePayloadDescription
remove[id: string]
update:selected[value: string | null]
update:view[value: CanvasView]
move[id: string, x: number, y: number]
update:nodes[value: BlessGraphNode[]]
update:edges[value: GraphEdge[]]
connect[edge: GraphEdge]
disconnect[edge: GraphEdge]

Slots

NameScopeDescription
node{ node: BlessGraphNode; selected: boolean; }

Released under the MIT License. Character names and artwork belong to their owners.