ValyroUI Русская версия

Node Canvas

Infinite node canvas: typed ports, links, groups, minimap, graph execution. Pro · Image generation › Node graph

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add node-canvas
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { NodeCanvas } from 'valyro-ui-pro';

Props

PropTypeDefault
editorNodeGraphEditorState from useNodeGraph, shared with NodeInspector, NodeLibrary… Without it the canvas keeps its own.
typesreadonly NodeTypeDef[]Node type registry (when no editor is passed).
graphNodeGraphControlled graph (when no editor is passed).
defaultGraphNodeGraphInitial graph when uncontrolled.
onGraphChange(graph: NodeGraph) => voidCalled with the new graph when it changes.
executionReadonly<Record<string, NodeExecutionState>>NO_EXECUTIONRun state per node id: status, progress, error, output images.
errorsreadonly GraphError[]NO_ERRORSValidation problems to show: missing inputs get a red port and an error badge.
viewportViewportControlled viewport; use with onViewportChange.
defaultViewportViewportInitial viewport when uncontrolled.
onViewportChange(viewport: Viewport) => voidCalled with the new viewport when it changes.
fitViewOnMountbooleantrueFits the graph into view on mount (ignored with a controlled viewport).
minFitZoomnumber0.75Smallest zoom the fit on mount settles on, so ports and widgets stay readable. A graph that does not fit at it opens at its left and top edges, clear of the controls and minimap, moved just enough to show the selection; its right / bottom end is cut. The Fit button and apiRef.fitView() still show the whole graph.
minZoomnumber0.1Smallest zoom factor reachable by wheel, pinch, the zoom buttons and fit. @default 0.1
maxZoomnumber2.5Largest zoom factor reachable by wheel, pinch and the zoom buttons; fit never zooms past 1. @default 2.5
gridSizenumber20Grid spacing in canvas units, also the snap step. @default 20
snapToGridbooleanControlled snapToGrid; use with onSnapToGridChange.
defaultSnapToGridbooleanfalseInitial snapToGrid when uncontrolled.
onSnapToGridChange(snap: boolean) => voidCalled with the new snapToGrid when it changes.
lockedbooleanLocked: pan, zoom and select only.
defaultLockedbooleanfalseInitial locked when uncontrolled.
onLockedChange(locked: boolean) => voidCalled with the new locked when it changes.
minimapbooleantrueOverview map in the corner; click or drag in it to move the view. Hidden while the canvas is under 640 px wide or 360 px tall.
controlsbooleantrueZoom, fit, snap and lock buttons. @default true
portTypesPortTypeStylesWire colour / display name per socket type; defaults come from the theme's wire palette.
childrenReactNodeRendered over the canvas, e.g. a floating toolbar or run button.
localestringNumber formatting in widgets. Defaults to the ThemeProvider locale.
labelsPartial<NodeCanvasLabels>Overrides for the built-in English text; keys left out keep their defaults.
widgetLabelsPartial<NodeWidgetLabels>Text of the built-in node widgets: number steppers, seed controls and image upload.
apiRefRef<NodeCanvasApi>Imperative fit / zoom / focus.

Related components

Previous: Image Adjustments · Next: Node Library · All Image generation