Fragiola

API: primitives (@fragiola/flow-react, @fragiola/flow-vue, @fragiola/flow-svelte, @fragiola/flow-angular)

EdgeLabel

Flow.EdgeLabel is HTML centred on an edge's label point, in flow coordinates, so it pans and zooms with the edge it names.

Flow.EdgeLabel goes inside Flow.Edge and is portalled into the HTML layer of Flow.Edges (SVG holds no HTML), centred on the path's label point: halfway along the path, in flow coordinates. It renders only its children (text from the edge's data, a badge, a button). A press on it selects its edge; a button in it keeps its own clicks.

Edge labels
Gallery
<Flow.Edge<Types> edge={edge}>
    <Flow.EdgePath />
    <Flow.EdgeLabel className="rounded bg-white px-1 text-xs">{edge.data?.text}</Flow.EdgeLabel>
</Flow.Edge>

Props

EdgeLabelProps extends the common primitive props and every div attribute.

proptypedefaultdescription
edgeIdstringthe enclosing Flow.Edge'sthe edge
childrenReactNodenonethe label

State

EdgeLabelState, what className, style and render receive:

fieldtypedescription
edgeIdstringthe edge
pathEdgePaththe path, its label point and its ends
selectedbooleanthe edge is selected

Data attributes

attributevalue
data-flow-part"edge-label"
data-flow-idthe edge's id
data-selectedpresent while the edge is selected
data-animatedpresent while the edge's animated flag is set

Structural style

position: absolute; top: 0; left: 0; transform: translate(<x>px, <y>px) translate(-50%, -50%) at the label point, and pointer-events: all.