Overview
The@crystalflow/react package includes:
WorkflowBuilder
Complete workflow editor component
Custom Hooks
React hooks for workflow management
Node Components
Customizable node renderers
Panels & Controls
Property panels and toolbars
Installation
Basic Usage
App.tsx
WorkflowBuilder Props
NodeClass[]
required
Array of node classes to make available in the palette
Workflow
Optional initial workflow to load
(workflow: Workflow) => void
Callback when workflow changes
(result: ExecutionResult) => void
Callback when workflow executes
boolean
default:"true"
Show/hide the toolbar
boolean
default:"true"
Show/hide the node palette
boolean
default:"true"
Show/hide the property panel
Complete Example
Using Custom Hooks
For more control, use the underlying hooks:Node Palette
The node palette allows users to drag and drop nodes:Property Panel
The property panel displays node properties and inputs:Toolbar Actions
Customizing Appearance
Custom Node Renderer
Styling
styles.css
React Flow Integration
WorkflowBuilder is built on React Flow. Access React Flow features:Event Handling
Handle workflow events:Keyboard Shortcuts
Planned keyboard shortcuts:Delete- Remove selected nodesCtrl/Cmd + Z- UndoCtrl/Cmd + Shift + Z- RedoCtrl/Cmd + S- Save workflowCtrl/Cmd + E- Execute workflow
Persistence
Save and load workflows:Monaco Editor Integration
Planned features:- Side-by-side visual and JSON editing
- Real-time sync between modes
- JSON schema validation
- Syntax highlighting
Best Practices
Provide Clear Node Labels
Provide Clear Node Labels
Use descriptive labels and categories to help users find nodes.
Handle Errors Gracefully
Handle Errors Gracefully
Show user-friendly error messages when execution fails.
Auto-Save Workflows
Auto-Save Workflows
Implement auto-save to prevent data loss.
Validate Before Execute
Validate Before Execute
Validate workflows before execution and show validation errors.
Provide Visual Feedback
Provide Visual Feedback
Show execution progress and node states during workflow execution.
Example Projects
Check out complete example projects in the repository:- Simple Math Workflow - Basic arithmetic operations
- Data Processing Pipeline - Fetch, filter, transform data
- API Integration - HTTP requests and response handling
Next Steps
WorkflowBuilder API
Complete WorkflowBuilder reference
React Hooks
All available React hooks
Component API
Individual component docs
Examples
View complete examples