This is a comprehensive tutorial for building a complete visual workflow application with React. For a quick 5-minute intro, see Visual Builder Quick Start.
- Multiple custom nodes (input, math, display)
- Visual drag-and-drop interface
- Property editing panel
- Save/load functionality
- Execution with progress feedback
- Error handling
What We’ll Build
A calculator workflow app where users can:- Add number input nodes and set values
- Drag math operation nodes (add, multiply, subtract)
- Connect nodes visually
- Execute the workflow and see results
- Save/load workflows as JSON

Prerequisites
- Node.js 18+ installed
- Basic React knowledge
- Familiarity with TypeScript
Step 1: Create React Project
We’ll use Vite for fast development:Step 2: Install CrystalFlow
Step 3: Configure TypeScript
Updatetsconfig.json to enable decorators:
tsconfig.json
Step 4: Create Custom Nodes
Create asrc/nodes directory for your workflow nodes.
Number Input Node
src/nodes/NumberInputNode.ts
Math Nodes
src/nodes/MathNodes.ts
Display Node
src/nodes/DisplayNode.ts
Export All Nodes
src/nodes/index.ts
Step 5: Create the Main App Component
Now let’s create the React component that uses CrystalFlow’s visual builder:src/App.tsx
Step 6: Add Styling
Createsrc/App.css:
src/App.css
Step 7: Update Main Entry Point
Updatesrc/main.tsx:
src/main.tsx
Step 8: Run Your App
Using Your Workflow Builder
Add Nodes
Drag nodes from the left palette onto the canvas. Try adding:
- Two Number Input nodes
- One Add node
- One Display node
Set Values
Click a Number Input node to select it. In the right property panel, set its value (e.g., 5 and 3).
Connect Nodes
Drag from the output handle (right side, blue dot) of Number Input to the input handle (left side) of the Add node. Connect both inputs.
Adding Features
Save and Load Workflows
Add save/load handlers:Add Progress Tracking
Display Node Results
Show output values from each node:What You’ve Built
✅ Complete visual workflow builder UI✅ Drag-and-drop node palette
✅ Visual node connections
✅ Property editing panel
✅ Workflow execution with feedback
✅ Custom math and display nodes
✅ Error handling and status display
Next Steps
Creating Custom Nodes
Build more powerful custom nodes
Execution & Events
Master workflow execution
Serialization
Save/load workflows properly
Examples
See more complete examples
Troubleshooting
Nodes not showing in palette?
Nodes not showing in palette?
Make sure all node classes have the
@defineNode decorator and are passed to the nodes prop.Connections not working?
Connections not working?
Verify port types match. An output of type
'number' can only connect to an input of type 'number' or 'any'.Properties not editable?
Properties not editable?
Properties use
@Property decorator, not @Input. Inputs are for connections, properties are for configuration.Execution fails silently?
Execution fails silently?
Check the browser console for errors. Add the
onError callback to capture errors.