Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Workflow Canvas

ProNew

A canvas for building a conversation flow: say, listen, condition, tool, transfer and end steps that drag and snap, connections drawn from port to step, pan, pinch and fit, and a run that lights its path as it goes.

Installation

pnpm dlx shadcn@latest add @viewport/workflow-canvas

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
nodes*WorkflowNode[]—
edges*WorkflowEdge[]—
onNodesChange(nodes: WorkflowNode[]) => void

Called as steps are dragged, nudged or deleted. Leave it out for a read-only canvas.

—
onEdgesChange(edges: WorkflowEdge[]) => void

Called when a connection is drawn or removed.

—
selectedstring | null

The id of the selected step.

—
onSelectedChange(id: string | null) => void—
pathstring[]

The steps a run has passed through, in order. They and the connections between them are lit, and the last one pulses while `running`.

[]
runningbooleanfalse
accentstring

The color of a run.

"oklch(0.68 0.14 235)"
labelstring

Accessible name of the canvas.

"Workflow"
classNamestring—

Accessibility

  • Steps are buttons named with their kind and where each way out leads.
  • Arrow keys nudge the selected step; Delete removes it; each connection has its own remove button.
  • The whole flow is repeated as a list for screen readers.
  • Drawing a connection needs a pointer, so pair it with a form that sets the next step.
  • Entrances, the fit transition and the moving connection are off under reduced motion.