Motia Icon
Workbench

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.

Currently, UI steps are only supported in TypeScript and JavaScript

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:

steps/
  └── myStep/
  ├── myStep.step.ts      # Step definition
  └── myStep.step.tsx     # Visual override

Basic Usage

// myStep.step.tsx
 
import React from 'react'
import { EventNode } from 'motia/workbench'
import type { EventNodeProps } from 'motia/workbench'
 
export default function MyStep({ data }: EventNodeProps) {
  return (
    <EventNode
      data={data}
      variant="white"
      className="py-2 px-4"
    />
  )
}

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.

EventNode

The main component for general-purpose steps.

PropTypeDescription
dataEventNodeProps['data']Step data passed from Workbench
variant'white' | 'ghost' | 'noop'Visual style variant
shape'rounded' | 'square' | 'noop'Node shape style
classNamestringAdditional CSS classes
// customStep.step.tsx
 
import React from 'react'
import { EventNode } from 'motia/workbench'
import type { EventNodeProps } from 'motia/workbench'
 
export default function CustomStep({ data }: EventNodeProps) {
  return (
    <EventNode
      data={data}
      variant="white"
      shape="rounded"
      className="py-2 px-4"
    >
      <div>Custom content</div>
    </EventNode>
  )
}

The EventNodeProps type provides essential information about your step. Here are the key properties:

PropertyTypeDescription
typestringThe type of the step
namestringThe name of the step
descriptionstringA detailed description of the step
subscribesstring[]List of topics this step listens to
emitsstring[]List of topics this step emits
languagestringThe programming language used

ApiNode

Specialized component for API-related steps.

PropTypeDescription
dataApiNodeProps['data']API step data
classNamestringAdditional CSS classes
// apiStep.step.tsx
 
import React from 'react'
import { ApiNode } from 'motia/workbench'
import type { ApiNodeProps } from 'motia/workbench'
 
export default function ApiStep({ data }: ApiNodeProps) {
  return (
    <ApiNode
      data={data}
      className="border-blue-500"
    >
      <div>API endpoint: {data.name}</div>
    </ApiNode>
  )
}

The ApiNodeProps type provides essential information about your step. Here are the key properties:

PropertyTypeDescription
typestringThe type of the step
namestringThe name of the step
descriptionstringA detailed description of the step
emitsstring[]List of topics this step emits
subscribesstring[]List of topics this step listens to
webhookUrlstringThe URL of the webhook
bodySchemaJSONSchema7The schema of the body of the request

Styling Guidelines

GuidelineDescription
Use Tailwind's utility classes onlyStick to Tailwind CSS utilities for consistent styling
Avoid arbitrary valuesUse predefined scales from the design system
Keep components responsiveEnsure UI elements adapt well to different screen sizes
Follow Motia's design systemMaintain consistency with Motia's established design patterns

Custom styles should be minimal and consistent with the overall Workbench UI.

Best Practices

PracticeDescription
Use base componentsUse EventNode and ApiNode when possible
Keep it simpleMaintain simple and clear visualizations
Optimize performanceMinimize state and computations
DocumentationDocument custom components and patterns
Style sharingShare common styles through utility classes
Need help? See our Community Resources for questions, examples, and discussions.

On this page