Choose what a workflow step does from a searchable catalog of apps and events.
- Recently used
- Team ChatChannels and direct messages.
- Pipeline CRMContacts, companies and deals.
- Built-in tools
- FilterOnly continue when conditions are true.
- PathsSplit into paths with their own rules.
- DelayWait before the next step.
- FormatterChange text, numbers and dates.
- Sales and CRM
- Pipeline CRMContacts, companies and deals.
- Communication
- Team ChatChannels and direct messages.
- MailSend and receive email.
- Payments
- BillingPayments and subscriptions.
- Databases
- Data WarehouseYour admin hasn’t allowed this app.
Search “send”, or open an app.
import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { UiSchema } from "@effect/ui"import { StepPicker } from "./ui/uicontext/components/kit/StepPicker.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, font, space } from "./ui/uicontext/components/tokens.stylex.ts"import { catalog } from "./automation.ts"const styles = stylex.create({ frame: { display: "flex", flexDirection: "column", gap: space.md, inlineSize: "min(100%, 26rem)", blockSize: 460 }, picked: { margin: 0, fontSize: font.sm, color: color.muted },})const Message = UiSchema.TaggedEnum({ Picked: { app: Schema.String, event: Schema.String }, Closed: {} })export const AddAStep = Html.component({ name: "AddAStep", model: Schema.NullOr(Schema.String), message: Message,}).make({ init: () => null, update: { Picked: ($, { app, event }) => { const a = catalog.find((x) => x.id === app) return `${a?.name ?? app}: ${a?.events.find((e) => e.id === event)?.label ?? event}` }, Closed: () => "Closed without choosing", }, view: (h, picked) => h.div.attrs(sx(styles.frame)).children( StepPicker(h, { props: { apps: catalog, for: "action", recent: ["chat", "crm"], agentId: "step-picker-demo" }, onEmit: { Picked: ({ app, event }) => Message.Picked({ app, event }), RequestedClose: () => Message.Closed() }, }), h.p.attrs({ role: "status", ...sx(styles.picked) }).children(picked === null ? "Search “send”, or open an app." : `Chose ${picked}`), ),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/step-pickerUsage
import { StepPicker, type StepPickerApp } from "./ui/uicontext/components/kit/StepPicker.ts"const Message = UiSchema.TaggedEnum({ PickedStep: { app: Schema.String, event: Schema.String }, ClosedPicker: {},})export const AddStep = (h: Html.H<typeof Message.Type>, apps: ReadonlyArray<StepPickerApp>) => StepPicker(h, { props: { apps, for: "action" }, onEmit: { Picked: ({ app, event }) => Message.PickedStep({ app, event }), RequestedClose: () => Message.ClosedPicker(), }, })Examples
Choose a trigger
For the first step, only apps with triggers are offered, and an app with one trigger picks it at once.
- Built-in tools
- ScheduleStart on a schedule.
- Forms and surveys
- FormsResponses to your forms.
- Sales and CRM
- Pipeline CRMContacts, companies and deals.
- Communication
- Team ChatChannels and direct messages.
- MailSend and receive email.
- Payments
- BillingPayments and subscriptions.
import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { StepPicker } from "./ui/uicontext/components/kit/StepPicker.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { catalog } from "./automation.ts"const styles = stylex.create({ frame: { inlineSize: "min(100%, 26rem)", blockSize: 420, display: "flex", flexDirection: "column" } })export const ChooseATrigger = Html.component({ name: "ChooseATrigger", model: Schema.Struct({}), message: Schema.Never,}).make({ init: () => ({}), update: ($) => $.model, view: (h) => h.div.attrs(sx(styles.frame)).children( StepPicker(h, { props: { apps: catalog, for: "trigger", agentId: "step-picker-trigger", label: "Search triggers" }, onEmit: { Picked: () => undefined, RequestedClose: () => undefined }, }), ),})Loading
Placeholder rows hold the space while the catalog loads.
import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { StepPicker } from "./ui/uicontext/components/kit/StepPicker.ts"import { sx } from "./ui/uicontext/components/Sx.ts"const styles = stylex.create({ frame: { inlineSize: "min(100%, 26rem)" } })export const LoadingCatalog = Html.component({ name: "LoadingCatalog", model: Schema.Struct({}), message: Schema.Never,}).make({ init: () => ({}), update: ($) => $.model, view: (h) => h.div.attrs(sx(styles.frame)).children( StepPicker(h, { props: { apps: [], for: "action", status: "loading", agentId: "step-picker-loading" }, onEmit: { Picked: () => undefined, RequestedClose: () => undefined }, }), ),})API reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
appsrequired | StepPickerApp[] | — | Every app and built-in tool the workspace offers |
forrequired | "trigger" | "action" | — | A trigger starts the workflow; any later step is an action or a search |
recent | string[] | — | Apps used recently, by id, newest first; shown above the catalog |
status | "loading" | "ready" | — | loading shows placeholder rows while the catalog loads |
autoFocus | boolean | — | Move focus to the search box when it appears, as when a step was just added |
label | string | — | The search box's label; "Search apps" by default |
agentId | string | step-picker | The id agents know this picker by; step-picker by default |
Events
| Event | Payload | Description |
|---|---|---|
Picked | { app: string; event: string } | The person chose what the step does |
RequestedClose | {} | Escape with nothing left to clear: close the picker |
Agent actions
| Action | Description |
|---|---|
UpdatedQuery | Search apps and what they do |
ClickedApp | Open an app by id to see its events |
ClickedEvent | Pick what the step does, by app id and event id (see page_query choices, app/event) |
ClickedBack | Go back to all apps |
Accessibility
- The search box is a combobox: the arrows move through the results, Enter opens an app or picks an event, and Escape clears the search, then goes back, then asks to close.
- Results are a listbox in labelled groups; the number of results is announced as you type.
- Apps and events the workspace doesn't allow stay listed, marked unavailable, with the reason.