Drag and drop
FlowCanvas
Interactive node-and-edge workflow canvas with pointer dragging, keyboard node positioning, and zoom controls.
import '@reactloom/dnd/styles.css';
import { FlowCanvas } from '@reactloom/dnd';Examples
Notification workflow
import { FlowCanvas } from '@reactloom/dnd';
const nodes = [
{ id: 'trigger', label: 'Webhook received', description: 'POST /events', x: 24, y: 120, tone: 'accent' as const },
{ id: 'validate', label: 'Verify signature', description: 'HMAC-SHA256', x: 240, y: 56 },
{ id: 'dispatch', label: 'Queue notification', description: 'Email & push', x: 460, y: 120, tone: 'success' as const },
];
const edges = [
{ id: 'e1', from: 'trigger', to: 'validate', label: 'Parse' },
{ id: 'e2', from: 'validate', to: 'dispatch', label: 'Valid' },
];
export default function Example() {
return <FlowCanvas defaultNodes={nodes} edges={edges} height={280} label="Notification pipeline" />;
}API reference
| Prop | Type | Default |
|---|---|---|
nodes · defaultNodesControlled or initial diagram nodes with x/y coordinates. | readonly FlowNode[] | — |
onNodesChangeCalled when nodes are moved. | (nodes: FlowNode[]) => void | — |
edgesrequiredDirected connections between node IDs. | readonly FlowEdge[] | — |
heightViewport height in pixels. | number | 380 |
Keyboard interaction
| Key | Action |
|---|---|
| Arrow keys | Move the focused node by 16px |
| Shift + Arrow keys | Move the focused node by 48px |
Usage guidelines
Do
- Provide concise node labels and optional descriptions for screen-reader users.
Don’t
- Avoid placing nodes at negative coordinates.