Workflow
A node canvas for chaining steps into an AI workflow and watching it run.
- Category
- AI
- Components used
- 20
- Files
- 14
- Usage examples
- 3
- Access
- HextaUI Pro (55 blocks)
- Source updated
- Counted in
- UI component usage study
Part of HextaUI Pro, all 55 blocks, $49 one-time, Compare plans
AI workflows are easiest to trust when you can see them. Workflow lays the steps out on a canvas: a trigger, the models that read and write, the tools they call, the conditions and loops between them and the people who approve the risky parts. Each card names the step, shows what it’s set to and flags what’s missing, so a run can’t start until the workflow is complete.
Press Run to try it with test input. Steps light up as they start, a highlight travels along each connection as work moves forward, and branches that weren’t taken fade out. A run log lists every step with its timing, tokens, input and output. Steps that wait for a person show Approve and Reject on the card, in the log and in the floating status bar, and a failed step offers Retry from here, which reuses the finished steps before it.
The canvas is a soft gray sheet of white cards. Each card has a tinted icon tile, the step’s name and type, a status pill that always names the state, and a sunken well that holds the settings when idle, what the step is doing while it runs and a preview of its output when it’s done. Conditions and loops list their branches as rows inside the card, with each connection leaving from its row. Connections are rounded blue lines that dim on paths the run didn’t take, and a short dash travels along the one doing work. The final step lights a soft pastel rainbow shadow under its bottom edge while it works, a selected step gets a blue ring and a softer version of the same shadow and lifts the connections around it, and green, amber and red only mean done, waiting and failed. On phones, and for screen readers, a List view shows the same workflow as an ordered list you can edit, run and approve from.
Get HextaUI Pro
One payment unlocks every block, including future ones. See pricing.
Add the Pro registry to components.json
components.json Add your token
Create a token on your account page and put it in
.env.localasHEXTAUI_PRO_TOKEN.Add the block
pnpm dlx shadcn@latest add @hextaui-pro/workflow
Saving and loading
Keep the graph in state with onChange and save it a moment after edits stop. serializeWorkflow writes a versioned JSON file with rounded positions, and parseWorkflow reads one back, throwing a readable error for anything it can’t load.
Streaming a run from your server
onRun is an async generator. Post the graph to your server and pass the response to readRunEvents, which reads server-sent events or one JSON event per line. Send step events such as {"type":"step","nodeId":"classify","status":"done","output":{…}} and end with a run event. onApprove sends a person’s answer back while the run waits.
Read-only embed
Set readOnly to show a workflow without the toolbar, editing or approvals, for docs, run reports and shared links. Pass a stored run to show how it went. Scrolling passes through to the page, and ⌘ or Ctrl with the wheel zooms.
Anatomy
The parts you compose, from the outside in.
| Part | Description |
|---|---|
Workflow | The editor: toolbar, canvas or list, side panel and status bar. Holds history, selection and the current run. |
Canvas | The node graph built on React Flow. It opens at 100% on the trigger, or fits the whole workflow when it’s small enough, with zoom controls, an optional minimap and snapping. |
Step card | One step: an icon tile, title and type, a status pill, and a sunken well with its settings, live activity or output preview. Timing and tokens sit under the title during a run, and branching steps add one row per output. |
List view | The same step cards stacked in a tray in run order, with branches as rows that link to their targets. The default on narrow screens and the screen-reader alternative to the canvas. |
Step settings | Fields for the selected step, generated from its type, with Duplicate and Delete. |
Run log and history | Every step of the current run with timing, tokens, input and output, and a list of past runs to open again. |
Status bar | Floats over the canvas during a run with progress, the current step, elapsed time and Approve or Retry. |
Workflow
Also accepts every div prop except onChange.
| Prop | Type | Default |
|---|---|---|
nodesSteps with an id, a type, a position and their settings in data. data.title names the step. | WorkflowNode[] | – |
edgesConnections. sourceHandle picks the branch, such as "true" or "false" on a condition. | WorkflowEdge[] | – |
onChangeCalled after every edit, including undo and redo. Moves are reported once a drag ends. | (graph: WorkflowGraph) => void | – |
nodeTypesThe steps people can add: trigger, model, tool, condition, loop, approval and output. Spread it to add your own. | WorkflowNodeTypes | defaultNodeTypes |
onRunAn async generator that yields run events. Shows Run when set. Receives the graph, input, an AbortSignal for Stop, from when retrying, and approval(nodeId) to wait for a person. | WorkflowRunHandler | – |
onApproveCalled when someone approves or rejects. A rejected promise keeps the step waiting and shows a toast. | (approval: WorkflowApproval) => void | Promise<void> | – |
onRunCompleteCalled once a run succeeds, fails or is stopped. Store it and pass it back through runs. | (run: WorkflowRun) => void | – |
runsPast runs for the History tab. | WorkflowRun[] | – |
runShows a run you control instead of the live one, for example one loaded from your database. | WorkflowRun | null | – |
readOnlyHides the toolbar and turns off editing and approvals. | boolean | false |
nameShown in the toolbar. | string | "Untitled workflow" |
defaultInputFills the test input in the Run popover. | string | – |
defaultViewThe view to start in. By default the list under 768px wide and the canvas above. | "canvas" | "list" | – |
minimapShows the minimap at first. People can toggle it from the zoom controls. | boolean | false |
WorkflowNodeType
One entry in nodeTypes.
| Prop | Type | Default |
|---|---|---|
labelThe step’s name in menus and on cards. | string | – |
descriptionOne line shown when adding the step. | string | – |
iconShown beside the step’s title. Use a 16px line icon. iconFor(data) can change it per step. | ReactNode | – |
accentA text colour class for the icon tile, like text-chart-4. Muted when left out. | string | – |
activityThe verb shown in the card while the step runs, like Thinking or Calling. Defaults to Working. | string | – |
sublabelThe line under the title. Defaults to the type’s label. | (data) => string | – |
groupGroups steps in the add menu. | string | – |
fieldstext, textarea, select or slider fields for the settings panel. required fields block Run until filled, and when(data) shows a field only when it applies. | WorkflowField[] | – |
defaultsSettings for a new step. | WorkflowData | – |
inputSet false for triggers, which start the workflow and take no input. | boolean | true |
outputsOne per branch. An empty array ends the workflow. | { id, label? }[] | [{ id: "out" }] |
repeatsLets connections loop back through this step. | boolean | – |
summaryThe line under the title, such as “Hexta 2 · temp 0.2”. | (data: WorkflowData) => string | – |
WorkflowRunEvent
What onRun yields. Missing at values use the time the event arrives.
| Prop | Type | Default |
|---|---|---|
{ type: "step" }status is queued, running, waiting, done, failed or skipped. message is the question shown while waiting. | { nodeId, status, input?, output?, error?, tokens?, message?, at? } | – |
{ type: "run" }status is running, waiting, succeeded, failed or cancelled. Ending the run settles any steps still open. | { status, runId?, error?, at? } | – |
| Prop | Type | Default |
|---|---|---|
serializeWorkflow(graph, meta?)A versioned JSON file for saving or exporting. | string | – |
parseWorkflow(json)Reads a saved file. Throws an error that names the broken node or edge. | WorkflowGraph | – |
readRunEvents(response)Reads a fetch response of server-sent events or JSON lines, and throws the server’s message if the request failed. | AsyncGenerator<WorkflowRunEvent> | – |
validateWorkflow(graph, types)What blocks a run, such as a missing trigger, a step with no input or an empty required field. | WorkflowIssue[] | – |
layoutWorkflow(graph, types, options?)Positions steps left to right by depth. Arrange steps uses it. | WorkflowNode[] | – |
applyRunEvent(run, event)The reducer the editor uses, for building runs on your server. | WorkflowRun | – |
| Key | Action |
|---|---|
| Tab | Moves between steps, connections and controls. |
| Enter | Opens the focused step’s settings, or its log during a run. |
| ↑↓←→ | Moves the selected steps. Hold Shift to move further. |
| N | Adds a step after the selected one, or in the middle of the view. |
| ⌫ | Deletes the selected steps or connection. |
| ⌘Z | Undoes. Add Shift to redo. |
| ⌘C | Copies the selected steps. ⌘X cuts, ⌘V pastes and ⌘D duplicates. |
| ⌘A | Selects every step. Shift and drag selects an area. |
| + | Zooms in. - zooms out, ⇧1 fits everything and ⇧0 goes to 100%. |
| ⌘↵ | Opens Run, or starts the run from the test input. |
| Esc | Closes the step settings or the add menu. |
- The List view is the screen-reader alternative to the canvas. It’s an ordered list in run order, each step is a button naming its type and settings, branches are links to the step they lead to, and adding, running, approving and retrying all work from it.
- On the canvas every step and connection is focusable and labelled, such as “Classify email, Model step”, and handles and add buttons name the step they belong to.
- Changes are announced through a polite live region: added, deleted, connected, undone, a step waiting for approval, a failed step and how the run ended. Refused connections explain why, for example “That would run in circles”.
- Status is never colour alone. Every state has an icon and a word, a taken branch is also marked in text, and skipped connections turn dashed.
- Selection, hover and keyboard focus look different. A selected step gets a blue ring and a soft rainbow shadow underneath and reads “Selected” to screen readers, keyboard focus adds a separate ring around it, and the open step in the List view, the run log and History is marked as current. Opening a step in the run log selects it on the canvas and pans it into view.
- Motion respects reduced motion: the run flow, card pop-in, connection draw and arrange glide are replaced by instant changes, and the rainbow shadow under the final or selected step stays still.
Built with
The free HextaUI components Workflow is made from. Each one installs on its own.
Code
14 files, added to components/blocks/workflow.