terra vidhal

Workflow Editor

Component

About

A visual automation builder with typed steps, a reorderable run rail, condition branches, per-step pausing, an inspector and a staged simulation log.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Workflow Editor to your project and fits it to your theme.

Code

How Workflow Editor is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import {
  WorkflowEditor,
  type StepRunState,
  type WorkflowLogLine,
  type WorkflowStep,
} from "@/components/ui/workflow-editor";

const STEPS: WorkflowStep[] = [
  {
    id: "trigger",
    kind: "trigger",
    title: "New request submitted",
    detail: "Fires when a request form is submitted with a budget and an owner.",
  },
  {
    id: "create",
    kind: "action",
    title: "Create the workspace",
    detail: "Provision the project, invite the requester and copy the starter template.",
  },
  {
    id: "condition",
    kind: "condition",
    title: "Budget above 5,000",
    detail: "Only high-budget requests need a human review before anything is provisioned.",
  },
  {
    id: "notify",
    kind: "action",
    title: "Page the on-call lead",
    detail: "Send a review request with the budget, owner and workspace link.",
    skipWhenFalse: true,
  },
  {
    id: "wait",
    kind: "delay",
    title: "Wait for the review window",
    detail: "Give the reviewer time to respond before the next checkpoint.",
    seconds: 10,
  },
  {
    id: "announce",
    kind: "notify",
    title: "Post to the operations channel",
    detail: "Share the outcome, the final budget and who approved it.",
    enabled: false,
  },
];

const RUN_STATES: Record<string, StepRunState> = {
  trigger: "done",
  create: "done",
  condition: "done",
  notify: "skipped",
  wait: "done",
  announce: "skipped",
};

const DURATIONS: Record<string, number> = {
  trigger: 180,
  create: 920,
  condition: 140,
  notify: 60,
  wait: 2400,
  announce: 50,
};

const LOGS: WorkflowLogLine[] = [
  { tone: "ok", text: "New request submitted finished." },
  { tone: "ok", text: "Create the workspace finished." },
  { tone: "ok", text: "Budget above 5,000 resolved false — the guarded action will be skipped." },
  { tone: "warn", text: "Page the on-call lead skipped because the condition resolved false." },
  { tone: "warn", text: "Post to the operations channel skipped because the step is disabled." },
  { tone: "ok", text: "Workflow completed." },
];

export default function WorkflowEditorDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-6 sm:px-6">
      <WorkflowEditor
        variant="plain"
        density="compact"
        initialSteps={STEPS}
        title="Request intake automation"
        defaultSelectedId="condition"
        defaultConditionPasses={false}
        defaultRunState="done"
        defaultStepStates={RUN_STATES}
        defaultRunSummary={{ elapsed: 3120, done: 4, skipped: 2 }}
        defaultStepDurations={DURATIONS}
        defaultLogs={LOGS}
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.