Blocks / Step card

Step card

One step: icon, name, call, and the state of its last run. A list row or a canvas node.

import { StepCard } from "@forgeron/ui";
/01 → States
Trigger:
Deal moved to WonCRM · onDealWon()
Succeeded12 ms · 1 item
Send the invoiceMail relay · send()
FailedMail relay answered 503
Tell #salesChat · postMessage()
import { Mail01Icon, Message01Icon, TrophyIcon } from "@forgeron/icons";
import { StepCard } from "@forgeron/ui";

export default function States() {
  return (
    <div style={{ display: "grid", gap: 16, width: 320, paddingTop: 10 }}>
      <StepCard
        kind="trigger"
        icon={TrophyIcon}
        title="Deal moved to Won"
        subtitle="CRM · onDealWon()"
        status="success"
        meta="12 ms · 1 item"
      />
      <StepCard
        icon={Mail01Icon}
        title="Send the invoice"
        subtitle="Mail relay · send()"
        status="error"
        error="Mail relay answered 503"
      />
      <StepCard icon={Message01Icon} title="Tell #sales" subtitle="Chat · postMessage()" />
    </div>
  );
}
/02 → As a canvas node
Running
ReusedReused from #1203 · 1 item
import { Delete02Icon, GitForkIcon, Invoice01Icon } from "@forgeron/icons";
import { IconButton, StepCard } from "@forgeron/ui";
import { useState } from "react";

// layout="node": 240px wide, the state on the top edge. The body of a node of @forgeron/flow:
// the canvas draws the ports and the wires around it.
export default function AsACanvasNode() {
  const [selected, setSelected] = useState("if");
  return (
    <div style={{ display: "flex", gap: 32, flexWrap: "wrap", paddingTop: 12 }}>
      <StepCard
        layout="node"
        kind="logic"
        icon={GitForkIcon}
        title="Above €5,000?"
        subtitle="Flows · ifElse()"
        status="running"
        selected={selected === "if"}
        onSelect={() => setSelected("if")}
      />
      <StepCard
        layout="node"
        icon={Invoice01Icon}
        title="Draft the invoice"
        subtitle="Invoices · createDraft()"
        status="reused"
        meta="Reused from #1203 · 1 item"
        selected={selected === "inv"}
        onSelect={() => setSelected("inv")}
        actions={<IconButton icon={Delete02Icon} label="Delete" size="sm" />}
      />
    </div>
  );
}
/03 → Skipped and disabled
Log the dealData hub · insert()
Not reached
Summarise the threadAI Gateway · complete()
Disabled
import { Database01Icon, SparklesIcon } from "@forgeron/icons";
import { StepCard } from "@forgeron/ui";

export default function SkippedAndDisabled() {
  return (
    <div style={{ display: "grid", gap: 16, width: "100%", maxWidth: 420 }}>
      <StepCard
        icon={Database01Icon}
        title="Log the deal"
        subtitle="Data hub · insert()"
        status="skipped"
      />
      <StepCard
        icon={SparklesIcon}
        title="Summarise the thread"
        subtitle="AI Gateway · complete()"
        disabled
      />
    </div>
  );
}
API → Props
PropTypeDefaultDescription
titlestring—The name of the step in this automation.
subtitlestring—What it calls, in mono: Chat · postMessage().
iconIconDefinition—Its pixel icon, in a tile.
kind"trigger" | "action" | "logic""action"A trigger gets the bolt mark and an ember tile.
status"idle" | "running" | "success" | "error" | "skipped" | "reused""idle"The state of the last run, in a word and an LED, and in the outline.
meta / errorstring—After a run: 120 ms · 3 items, or the error.
disabledboolean—Hatched and struck through: items pass through.
layout"row" | "node""row"node: 240px wide, the state on the top edge, for @forgeron/flow.
selectedboolean—Outlined in ember: the step in the inspector.
onSelect() => void—Makes the card a button.
actionsReactNode—Small buttons shown on hover and focus.
classNamestring—Extra classes.