Skip to content

Install React Flow and scaffold WorkflowCanvas base component #1095

Description

@geoffjay

Summary

Add @xyflow/react (React Flow v12) as a dependency and create the foundational WorkflowCanvas component that all subsequent workflow builder features will build upon.

Context

The agentd UI currently uses form-based CRUD for workflow management. This issue introduces the base canvas infrastructure for a visual workflow builder. React Flow is a mature, MIT-licensed library for building node-based editors and is the standard choice for workflow visualization in React applications.

Implementation Details

1. Install dependency

cd ui && bun add @xyflow/react

React Flow v12 (@xyflow/react) ships its own TypeScript types and CSS.

2. Create base canvas component

Create ui/src/components/workflows/canvas/WorkflowCanvas.tsx:

  • Render a <ReactFlow> instance with:
    • <Controls /> - zoom in/out, fit view
    • <MiniMap /> - overview navigation
    • <Background variant="dots" /> - visual grid
  • Accept nodes, edges, onNodesChange, onEdgesChange, onConnect props
  • Import React Flow CSS (@xyflow/react/dist/style.css)
  • Wrap in a <ReactFlowProvider> at the appropriate level
  • Apply theme-compatible styling using existing --th-* CSS custom properties
  • Set sensible defaults: fitView, snapToGrid, snapGrid={[16, 16]}

3. Create barrel exports

  • ui/src/components/workflows/canvas/index.ts - export WorkflowCanvas
  • Update ui/src/components/workflows/index.ts to re-export canvas module

4. Add basic test

  • ui/src/components/workflows/canvas/WorkflowCanvas.test.tsx
  • Verify canvas renders without errors
  • Verify controls, minimap, and background are present

Files to Create/Modify

  • ui/package.json - add @xyflow/react dependency
  • ui/src/components/workflows/canvas/WorkflowCanvas.tsx - new component
  • ui/src/components/workflows/canvas/index.ts - barrel export
  • ui/src/components/workflows/index.ts - update exports
  • ui/src/components/workflows/canvas/WorkflowCanvas.test.tsx - tests

Acceptance Criteria

  • @xyflow/react installed and importable
  • WorkflowCanvas renders a React Flow canvas with controls, minimap, and background
  • Canvas styling is compatible with the existing theme system (--th-* variables)
  • Component accepts standard React Flow props (nodes, edges, callbacks)
  • snapToGrid enabled with 16px grid
  • Test passes verifying basic rendering
  • No regressions in existing workflow components

Stack Base

  • Stack on: feature/autonomous-pipeline
  • Parallel: no ordering constraint (can be implemented independently of type extensions)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity:mediumMedium scope: <200 lines, 1-2 filesenhancementNew feature or requestfrontendFrontend application codetriagedIssue has been triaged, ready for planning or implementationuiUser interface and frontend

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions