Workflow editor: steps on a dotted board joined by connections that carry the condition of each branch, a toolbar at the bottom and the configuration panel of a step on the right.
<.flow id="triage" edges={@edges} on_add="add_node" on_move="move_node" aria-label="Triage" class="h-[640px]">
<:node id="in" kind="Trigger" kind_icon="mail" icon="mail" title="Invoice received">
<.flow_section label="Event">An invoice arrives at the inbox.</.flow_section>
</:node>
<:node id="gate" kind="Approval" icon="shield" title="Approval" selected />
<:toolbar><button class="lu-b c-primary v-solid s-md">Add node</button></:toolbar>
<:panel label="Approval">
<.flow_panel_head icon="shield" title="Approval" on_close="close_panel" />
<.flow_panel_body>…fields…</.flow_panel_body>
</:panel>
</.flow>Layout
The server lays the steps out (no measuring): edges is a list of maps with from and to
(node ids) and optionally label and status ("done" green, "error" red; an edge into the
selected node takes the accent). A node's row is its depth along the edges, a parent is centred
over its children, and every connection is an SVG path drawn in the gap above its target with the
label on it. Without edges the nodes are a free grid, four to a row. Rows are
200px tall plus a gap, so keep a step's card about that size; the LedgerUI.Flow hook redraws
the connections from the real node boxes.
Dragging
With on_move the nodes can be dragged on the board (pointer events); a drop pushes
%{"id" => id, "x" => x, "y" => y} (to target when given). Keep the positions on the server
and pass them back as the x/y of the :node; the connections follow while dragging.
Events: on_add (the + button under nodes with no outgoing edge, phx-value-id of the node),
on_move (a node was dragged).
Summary
Functions
Attributes
id(:string) (required)edges(:list) - Defaults to[].on_add(:any) - Defaults tonil.on_move(:string) - Event pushed when a node is dragged (id,x,y). Defaults tonil.target(:any) -phx-targetofon_move. Defaults tonil.add_label(:string) - Defaults to"Add step after".node_width(:integer) - Defaults to300.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
actions- Buttons beside the selected node; the node id is the slot argument.hint- Accepts attributes:title(:string)left(:integer)top(:integer)width(:integer)class(:string)
node(required) - Accepts attributes:id(:string)title(:string)icon(:string)kind(:string)kind_icon(:string)status(:string)selected(:boolean)class(:string)metrics(:list)x(:integer)y(:integer)
panel- Accepts attributes:label(:string)
toolbar
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Attributes
title(:string) (required)icon(:string) - Defaults tonil.on_close(:any) - Defaults tonil.close_label(:string) - Defaults to"Close".class(:any) - Defaults tonil.- Global attributes are accepted.
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Attributes
label(:string) (required)class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Lays node_ids out along edges.
Returns %{positions: %{id => {x, y}}, width: w, height: h, edges: [...]} where every edge has
its SVG path d, the label position {lx, ly}, status, from and to.