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";Trigger:
Deal moved to WonCRM · onDealWon()
SucceededSend the invoiceMail relay · send()
FailedTell #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>
);
}Running
Reused
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>
);
}Log the dealData hub · insert()
Not reachedSummarise the threadAI Gateway · complete()
Disabledimport { 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
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | The name of the step in this automation. |
subtitle | string | — | What it calls, in mono: Chat · postMessage(). |
icon | IconDefinition | — | 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 / error | string | — | After a run: 120 ms · 3 items, or the error. |
disabled | boolean | — | Hatched and struck through: items pass through. |
layout | "row" | "node" | "row" | node: 240px wide, the state on the top edge, for @forgeron/flow. |
selected | boolean | — | Outlined in ember: the step in the inspector. |
onSelect | () => void | — | Makes the card a button. |
actions | ReactNode | — | Small buttons shown on hover and focus. |
className | string | — | Extra classes. |