FlowCanvas

An editable route drawn as a tree: conditions and splits branch downward, and each model's fallback hangs straight under it.

View source
Startfast
Conditionx-plan is paid1 rule
Modelclaude-opus-4-1Anthropic
Modelgpt-5-miniOpenAI

Arrow keys move between steps, Enter selects one, plus and minus zoom, and 0 fits the view.

  • fast to x-plan is paid
  • x-plan is paid to claude-opus-4-1, Then
  • claude-opus-4-1 to Add a fallback to claude-opus-4-1, Fallback
  • x-plan is paid to gpt-5-mini, Else
  • gpt-5-mini to Add a fallback to gpt-5-mini, Fallback
import { FlowCanvas } from "@logicplanes/kaeso-ui/flow-canvas";

Props

  • addMenu
    ((slot: FlowCanvasSlot) => ReactNode)

    Turns editing on: open slots and a + midway on every connection show, and each opens a menu with these items. Called with the connection's edge id and insert: false for an open slot, true for the + that puts a step before the connection's step. Without it, open slots are not drawn.

  • aria-label
    string

    The tree's accessible name: what the route belongs to, such as "Route of fast".

  • background
    "plain" | "dots" = dots

    A dotted grid that moves with the view, or the plain panel.

  • busy
    boolean

    A request is on its way along trace: its lines without a tone run as moving dashes, or pulse with reduced motion, and the tree is marked busy. Turn it off once the request answers.

  • nodeActions
    ((id: string) => ReactNode)

    Menu items for a step, shown in a button on the step and opened with Shift F10 or the context-menu key. Return nothing for a step without actions, such as the start.

  • onDelete
    ((id: string) => void)

    Called with a step's id when Delete or Backspace is pressed on it.

  • onSelect
    ((id: string | null) => void)

    Called with a step's id when it is clicked or chosen with Enter or Space, and with null when the background is clicked or Escape is pressed.

  • root
    FlowCanvasNode

    The start of the route. Each node has kind (its tag), title, an optional subtitle, leading (such as a provider badge), status (a word and a tone: danger, warning and success also ring the step), badge (a short word at its top right, such as its try), terminal (a model: its one connection is its fallback, drawn straight under it, with an open slot just below the model) and children: connections with an id, a label, a variant (fallback draws a dashed line), a tone (success, warning or danger: on a traced path, the line takes that color, such as the status a tried step answered with) and the node they lead to; a connection without a node is an open slot.

  • selected
    string | null = null

    The id of the selected step, drawn with the selection ring; the view moves to show it when it changes.

  • trace
    readonly string[]

    The ids of the steps one request passes, such as from a dry run: they and the lines between them stay strong, and every other step turns quieter: secondary text and a hairline, still readable. When its last step changes, the view moves to show that step. Leave it out to draw the route evenly.