Loading component…
Loading component…
An automation drawn as a top-down flow you build in place – a + on every line adds a step, If / else forks into named paths, and a test run sends a light down the line
To reuse this local React demo, copy all files from the Code tab into the same folder, then import FlowBuilder from ./flow-builder.
import { FlowBuilder } from "@/components/ui/flow-builder";
export function Automation({ flow, run }) {
return (
<FlowBuilder
name="Onboard new signups"
steps={flow.steps} // the first step is the trigger
onStepsChange={flow.save} // every add, move and remove
status={run.status} // { research: "done", welcome: "running", enterprise: "skipped" }
onRun={run.start}
onStop={run.stop}
onSelect={(id) => openInspector(id)}
/>
);
}
// A step
{ id: "welcome", kind: "action", icon: "mail", title: "Send welcome email", detail: "Gmail · from Flo",
note: "A personal welcome, written from the research" }
// An If / else – each path has its own steps
{ id: "size", kind: "branch", title: "Company size", detail: "employees > 200",
paths: [
{ id: "enterprise", label: "Enterprise", steps: [...] },
{ id: "self", label: "Self-serve", steps: [...] },
] }| Name | Type | Default | Description |
|---|---|---|---|
| name | string | "Untitled workflow" | The workflow's name, in the header |
| steps / defaultSteps / onStepsChange | FlowStep[] | The flow, controlled or not – the first step is the trigger. A step is { id, kind, title, detail?, note?, icon?, paths? } – note is the line that shimmers while it runs | |
| kind | "trigger" \| "action" \| "agent" \| "branch" \| "wait" | An agent step shows its pixel mark; a branch draws its paths side by side | |
| icon | "webhook" \| "schedule" \| "form" \| "mail" \| "message" \| "slack" \| "database" \| "http" \| "wait" \| "branch" \| "user" \| "task" \| "flash" | The glyph in the step's tile | |
| templates | { kind; title; detail?; icon?; paths? }[] | What the + menu offers – paths names the paths of a new If / else | |
| triggers | FlowTemplate[] | What Add a trigger offers while the flow is empty | |
| status | Record<string, "idle" \| "running" \| "done" \| "failed" \| "skipped"> | The test run, by step id; a path id set to skipped fades the whole path | |
| selected / defaultSelected / onSelect | string \| null | The selected step – open your own inspector from onSelect | |
| onRun / onStop | () => void | Run test, and Stop while it runs; Run test needs onRun and at least two steps | |
| height | number | 420 | Height of the canvas in px – it scrolls and pans inside |
| className | string | Extra class on the card |
No background of its own – it sits on your page; the canvas keeps its height, scrolls both ways with soft edges, pans by dragging and opens centred on the flow
Every step has one size, so nothing jumps while the test runs; each step's time is measured from the status you feed; long names end in an ellipsis with the full name on hover
Below 480px the steps get narrower, so two paths still sit side by side
The + menu opens below its line, or above it when there's no room, and stays inside the card
On touch screens the key hints go and each + gets a bigger target
Right-to-left: the layout mirrors
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"