Blocks / Step picker

Step picker

Triggers or actions to add: a search, categories, groups under a band; arrows and Enter.

import { StepPicker } from "@forgeron/ui";
/01 → Triggers
Start with a trigger
Built in
ScheduleRuns on a cron schedule
WebhookA signed URL for any system
Manual runSomeone clicks Run
App events
Deal moved to WonCRM
Ticket createdHelpdesk
import { ApiIcon, Clock01Icon, PlayCircleIcon, Ticket01Icon, TrophyIcon } from "@forgeron/icons";
import { StepPicker } from "@forgeron/ui";

export default function Triggers() {
  return (
    <div style={{ width: 340 }}>
      <StepPicker
        title="Start with a trigger"
        placeholder="Search triggers"
        groups={[
          { id: "core", label: "Built in" },
          { id: "apps", label: "App events" },
        ]}
        options={[
          {
            id: "schedule",
            group: "core",
            icon: Clock01Icon,
            label: "Schedule",
            description: "Runs on a cron schedule",
          },
          {
            id: "webhook",
            group: "core",
            icon: ApiIcon,
            label: "Webhook",
            description: "A signed URL for any system",
          },
          {
            id: "manual",
            group: "core",
            icon: PlayCircleIcon,
            label: "Manual run",
            description: "Someone clicks Run",
          },
          { id: "deal", group: "apps", icon: TrophyIcon, app: "CRM", label: "Deal moved to Won" },
          {
            id: "ticket",
            group: "apps",
            icon: Ticket01Icon,
            app: "Helpdesk",
            label: "Ticket created",
          },
        ]}
        onPick={() => {}}
      />
    </div>
  );
}
/02 → Actions after a step
Add a step
After “Deal moved to Won”
Apps
Post a messageChat
Send an emailMail relay
Create a taskTasks
Draft an invoiceInvoices
Logic
IfSplits items on a condition
SwitchOne path per value
For eachOnce per item
WaitPauses, then resumes
Data
Query a datasetData hub
Call an APIHTTP
AI
Ask a modelAI Gatewaybeta
Your code
Carrier ratesflows/blocks/carrier-rates.tscode
Missing a step? Write a function.
Picked: nothing yet
import {
  CodeIcon,
  Database01Icon,
  GitForkIcon,
  GlobeIcon,
  HourglassIcon,
  Invoice01Icon,
  Mail01Icon,
  Message01Icon,
  RepeatIcon,
  Route01Icon,
  SparklesIcon,
  Task01Icon,
} from "@forgeron/icons";
import { Button, StepPicker } from "@forgeron/ui";
import { useState } from "react";

const options = [
  { id: "chat", group: "apps", icon: Message01Icon, app: "Chat", label: "Post a message" },
  { id: "mail", group: "apps", icon: Mail01Icon, app: "Mail relay", label: "Send an email" },
  { id: "task", group: "apps", icon: Task01Icon, app: "Tasks", label: "Create a task" },
  { id: "invoice", group: "apps", icon: Invoice01Icon, app: "Invoices", label: "Draft an invoice" },
  {
    id: "if",
    group: "logic",
    icon: GitForkIcon,
    label: "If",
    description: "Splits items on a condition",
  },
  {
    id: "switch",
    group: "logic",
    icon: Route01Icon,
    label: "Switch",
    description: "One path per value",
  },
  { id: "each", group: "logic", icon: RepeatIcon, label: "For each", description: "Once per item" },
  {
    id: "wait",
    group: "logic",
    icon: HourglassIcon,
    label: "Wait",
    description: "Pauses, then resumes",
  },
  { id: "query", group: "data", icon: Database01Icon, app: "Data hub", label: "Query a dataset" },
  { id: "http", group: "data", icon: GlobeIcon, app: "HTTP", label: "Call an API" },
  {
    id: "ai",
    group: "ai",
    icon: SparklesIcon,
    app: "AI Gateway",
    label: "Ask a model",
    tag: "beta",
  },
  {
    id: "carrier",
    group: "code",
    icon: CodeIcon,
    label: "Carrier rates",
    description: "flows/blocks/carrier-rates.ts",
    tag: "code",
  },
];

export default function ActionsAfterAStep() {
  const [picked, setPicked] = useState<string | null>(null);
  return (
    <div style={{ display: "grid", gap: 12, width: "100%", maxWidth: 380 }}>
      <StepPicker
        title="Add a step"
        context="After “Deal moved to Won”"
        groups={[
          { id: "apps", label: "Apps" },
          { id: "logic", label: "Logic" },
          { id: "data", label: "Data" },
          { id: "ai", label: "AI" },
          { id: "code", label: "Your code" },
        ]}
        options={options}
        onPick={setPicked}
        footer={
          <>
            <span style={{ flex: 1 }}>Missing a step? Write a function.</span>
            <Button size="sm">New step</Button>
          </>
        }
      />
      <span className="t-mono dim">Picked: {picked ?? "nothing yet"}</span>
    </div>
  );
}
API → Props
PropTypeDefaultDescription
options{ id, label, description?, icon, group, app?, tag?, keywords? }[]—What can be added; group names the band it sits under.
groups{ id, label }[]—The groups in order, with their names.
onPick(id: string) => void—Click or Enter on an option.
title / contextReactNode—Add a step; After “Deal won”.
categoriesbooleantrueThe row of group filters.
footerReactNode—Under the list: write your own step.
autoFocusboolean—Focuses the search when shown.
classNamestring—Extra classes.