UI Steps
UI Steps provide a powerful way to create custom, visually appealing representations of your workflow steps in the Workbench flow visualization tool.
With UI Steps, you can enhance the user experience by designing intuitive, context-aware visual components that clearly communicate your flow's sequencing and events.
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 but keeping the same look. Like the image below. We're going to add an image on the side and show the description.
Components
Motia Workbench provides out of the box components that you can use to create custom UI steps, which apply to different types of steps.
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 |
Customizing completely
You can also fully customize your node making it look completely different from the result. Let's draw the following node.
Important Notes
- You will need to add
<BaseHandle>
to your node, otherwize 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 |
Best Practices
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 |