Customizing Flows
Create custom visualizations and represent external processes in your Motia workflows
Customizing Flows
Motia Workbench allows you to customize how your Steps appear in the flow visualization tool. This helps you create intuitive, context-aware visual components that clearly communicate your flow's behavior and external dependencies.
UI Steps
UI Steps provide a way to create custom visual representations of your workflow Steps in the Workbench flow visualization tool.
Overview
To create a custom UI for a Step, create a .tsx
or .jsx
file next to your Step file with the same base name:
Basic Usage
Let's override an EventNode while keeping the same look. We'll add an image and show the description.
Available Components
Motia Workbench provides out-of-the-box components for different Step types:
Component | Props Type | Description |
---|---|---|
EventNode | EventNodeProps | Base component for Event Steps, with built-in styling and connection points |
ApiNode | ApiNodeProps | Component for API Steps, includes request/response visualization capabilities |
CronNode | CronNodeProps | Base component for Cron Steps, displays timing information |
NoopNode | NoopNodeProps | Base component for NoopNodes with a different color to comply workbench legend |
Complete Customization
You can fully customize your node to look completely different. Here's an example of a custom ideator agent node:
Important Notes
- You will need to add
<BaseHandle>
to your node, otherwise it won't show the connectors. - If your node has padding, make sure to add a group inside your node with class
group relative
so the handles can be correctly positioned.
Styling Guidelines
Guideline | Description |
---|---|
Use Tailwind's utility classes only | Stick to Tailwind CSS utilities for consistent styling |
Avoid arbitrary values | Use predefined scales from the design system |
Keep components responsive | Ensure UI elements adapt well to different screen sizes |
Follow Motia's design system | Maintain consistency with Motia's established design patterns |
NOOP Steps
NOOP (No Operation) Steps are a powerful feature that serve multiple purposes:
- Modeling external processes, webhooks and integrations
- Representing human-in-the-loop activities
- Creating custom visualizations in the workbench
- Testing flows during development
File Structure
NOOP Steps require two files with the same base name:
stepName.step.ts
- Contains the step configurationstepName.step.tsx
- Contains the UI component (optional)
Step Configuration File
UI Component File
Example: Webhook Testing
Here's a complete example of a NOOP Step that simulates webhook events:
Representing External Processes
NOOP Steps represent parts of your workflow that happen outside your system. Common examples include:
Webhook Callbacks
Human Approvals
External System Integration
Best Practices
UI Steps
Practice | Description |
---|---|
Use base components | Use EventNode and ApiNode when possible |
Keep it simple | Maintain simple and clear visualizations |
Optimize performance | Minimize state and computations |
Documentation | Document custom components and patterns |
Style sharing | Share common styles through utility classes |
NOOP Steps
Category | Guidelines |
---|---|
File Organization | • Keep configuration and UI code in separate files • Use .step.ts for configuration• Use .step.tsx for UI components |
UI Components | • Use functional React components • Include proper TypeScript types • Follow Tailwind's utility classes • Keep components minimal and focused • Design clear visual connection points • Always include BaseHandle components for flow connections |
Configuration | • Always include virtualSubscribes (even if empty)• Use descriptive names for virtual events • Include clear descriptions • Use descriptive, action-oriented names |
External Process Modeling | • Document expected timeframes and SLAs • Define all possible outcomes and edge cases • Use exact API route matching |
Testing | • Create isolated test flows • Use realistic test data • Handle errors gracefully • Implement clear status indicators • Label test steps explicitly • Provide visual feedback for actions |
Component Reference
Core Imports
Import | Purpose |
---|---|
BaseHandle | A React component that renders connection points for nodes in the workflow. Used to define where edges (connections) can start or end on a node. |
EventNodeProps | (TypeScript only) Interface defining the properties passed to node components, including node data, selected state, and connection information. |
Position | (TypeScript only) Enum that specifies the possible positions for handles on a node (Top, Right, Bottom, Left). Used to control where connection points appear. |
Handle Placement
Handle Type | Position |
---|---|
Input Handles | Position.Top |
Output Handles | Position.Bottom |
Flow Direction | Top to bottom |