Getting StartedInstallation and setup guides 6
FormInput and selection components 26
LayoutWorkflow and structural layout components 10
NavigationMenu surfaces and hierarchical actions 7
OverlayModal and floating layer surfaces 3
FeedbackStatus, empty, progress, and loading placeholder patterns 6
UtilityGeneral-purpose interface utilities 7

Flow Editor API

Import the editor, template directives, graph types, event types, and validation helper from @tailng-ui/flow.

Editor inputs

NameTypeDefaultDescription
definitionTngFlowDefinition<TData, TConnectionData>null Controlled JSON workflow snapshot. Takes precedence over separate node and connection inputs.
nodesreadonly TngFlowNode<TData>[]nullControlled node records for the separate-input form.
connectionsreadonly TngFlowConnection[][]Controlled connector-to-connector edges.
presentationTngFlowPresentation<TStatus>{}Controlled runtime status and visual emphasis for nodes and connections.
validationTngFlowValidationEMPTY_TNG_FLOW_VALIDATIONControlled application issues merged with TailNG structural issues.
nodeViewsTngFlowNodeViews<TStatus>{}Deprecated compatibility input. Use presentation.nodes.
mode'edit' | 'inspect' | 'readonly''edit'Controls selection and graph editing permissions while preserving pan and zoom.
selectionTngFlowSelectionempty setsControlled node and connection selection owned by the consuming application.
viewportTngFlowViewport | nullnullOptional externally supplied canvas position and scale.
connectionValidatorTngFlowConnectionValidator | nullnullRuns after built-in connection validation for application-specific rules.
optionsTngFlowEditorOptions | nullnull Configures editor-level routing, marker and label defaults, global connection selection and reassignment gates, waypoint editing, and motion preference. Per-connection values take precedence.
connectionOptionsTngFlowEditorConnectionOptions | nullnull Focused compatibility input for the same connection options. Values supplied here take precedence over matching fields in options.
connectionAriaLabelTngFlowConnectionAriaLabelFactory | nullnull Optional accessible-name factory receiving the connection, endpoint descriptions, and resolved presentation state.
keyboardOptionsTngFlowKeyboardOptions | nullnull Overrides normal and coarse canvas movement steps and the keys that enter connection authoring. Defaults resolve from the active grid policy and ['c'].
smartGuidesTngFlowSmartGuidesOptions | nullnull Opts into magnetic alignment and spacing guides. Thresholds are screen pixels and disableModifier suppresses guides for the complete drag that starts with that modifier pressed.
commandShortcutsboolean | readonly TngFlowEditorCommand[]false Opts into all mode-allowed command shortcuts or an explicit allow-list. This affects keyboard interception only; direct requestCommand() calls still follow the active mode.
contextMenuEnabledbooleanfalse Replaces the native graph context menu with controlled contextMenuRequested events in edit and inspect modes.
readonly(deprecated)booleanfalseCompatibility alias that forces readonly mode when true.
ariaLabelstring'Workflow editor'Accessible name for the editor surface.
flowIdstring'tng-flow-editor'Stable Foblex flow instance id. Set a unique value for multiple editors.
fitOnInitbooleantrueFits the first non-empty node collection into the viewport.
showBackground, showControls, showSelectionAreabooleantrueControls the built-in grid, viewport toolbar, and marquee selection surface.
showMinimapbooleanfalse Shows the themed workflow overview. When interactive, hovering temporarily previews a position and leaving restores the canvas; clicking commits the previewed position.
minimapOptionsTngFlowMinimapOptions | nullnull Configures position, dimensions, minimum overview size, node render limit, interactivity, and accessible label.
snapToGridbooleanfalse Snaps node movement to gridSize. Multi-node keyboard movement applies one shared snapped delta so relative geometry is preserved.
gridSizenumber16 Base horizontal and vertical grid cell size in pixels. Controls the snap interval and the base dotted-background spacing.
backgroundGridModeTngFlowBackgroundGridMode'canvas''canvas' displays every base-grid point. 'adaptive' displays a fixed on-screen dot density while zooming in or out without changing the gridSize snap interval.
zoomMinimum, zoomMaximum, zoomStepnumber0.35, 2, 0.15Viewport zoom limits and button/wheel increment.

Editor outputs

NamePayloadWhen it emits
nodesMovedTngFlowNodesMovedEventAfter one or more selected nodes finish moving.
nodePositionChangeTngFlowNodePositionChangeOnce per moved node, with its previous and new positions.
nodeCreateRequestedTngFlowNodeCreateRequest<TData>After a typed palette drop, keyboard activation, or API creation request.
connectionCreateRequestedTngFlowConnectionCreateRequestAfter a connection candidate passes built-in and consumer validation.
connectionReconnectRequestedTngFlowConnectionReconnectRequestAfter a reassigned endpoint produces a valid complete connection.
connectionWaypointsChangeTngFlowConnectionWaypointsChange Once after an enabled waypoint add, move, or remove interaction commits in edit mode. The application writes the returned points into a new definition snapshot.
connectionsDeleteRequestedTngFlowConnectionsDeleteRequestWhen editable selected connections are requested for deletion.
nodesDeleteRequestedTngFlowNodesDeleteRequestWhen unlocked selected nodes are requested for deletion.
nodesArrangementRequestedTngFlowNodesArrangementRequest Once after a successful selected-node alignment or distribution request. Contains position-only moves and never mutates the controlled graph.
selectionChangeTngFlowSelectionWhen the user requests a different controlled selection.
commandRequestedTngFlowEditorCommandRequest After an enabled shortcut or successful requestCommand() call. The application owns history, clipboard data, validation, ids, and mutation.
contextMenuRequestedTngFlowContextMenuRequest After an enabled pointer or keyboard context request, with target, source, client and canvas coordinates, and the proposed controlled selection.
connectionRejectedTngFlowConnectionRejectedEventWhen a drop targets a known port but connection validation fails.
nodeActivatedTngFlowNodeActivatedEventOn node double-click, Enter activation, or the public activation API.
connectionActivatedTngFlowConnectionActivatedEventOn connection double-click, Enter activation, or the public activation API.
validationIssueActivatedTngFlowValidationIssueActivatedEventWhen a rendered issue marker is selected or activated through the API.
viewportChangeTngFlowViewportWhen canvas position or scale changes.
viewportChanged(deprecated)TngFlowViewportChangedEventCompatibility alias for viewportChange.
readyvoidAfter the flow completes its first full render.

Foblex gesture callbacks may run outside Angular's zone. Flow Editor re-enters the zone before every public output is emitted.

Graph models

TypeRequired fieldsOptional behavior
TngFlowDefinition<TNodeData, TConnectionData>id, nodes, connectionsOptional workflow name and typed node/connection data.
TngFlowNode<TData>id, type, name, positiondata, description, icon, disabled or locked state, and directed ports.
TngFlowPortid, direction, kind Name/label, data type, required state, disabled state, multiplicity, and explicit self-connection policy. Use side to place a port on the top, right, bottom, or left border. Inputs default to left and outputs to right. Port ids are scoped to their owning node.
TngFlowConnectionid, source, target Source and target are TngFlowEndpoint values containing nodeId and portId. Connections also support label, description, typed data, disabled, reassignable, selectable, persisted routing, source and target markers, and label placement. The legacy renderer-named type property is deprecated.
TngFlowPresentation<TStatus>noneRuntime status, progress, messages, highlights, dimming, and connection motion.
TngFlowConnectionPresentationnone Status, message and emphasis plus flow or pulse motion, speed, and direction. This state is never persisted into the graph connection.
TngFlowValidationissues Generic errors, warnings, and information with a discriminated flow, node, port, or connection target.
TngFlowPaletteItem<TData>id, type, nameCatalog metadata and optional node data. Its id is not a workflow node id.
TngFlowNodeCreateRequest<TData>item, position, sourceControlled request using a top-left canvas position.
TngFlowNodeBoundsid, position, size Measured unscaled canvas geometry accepted by the pure alignment and distribution utilities. Optional disabled and locked flags control participation.

Built-in statuses include idle, queued, running, waiting, completed, failed, paused, retrying, skipped, cancelled, and awaiting-input. Supply a custom string union through the editor's TStatus generic when your runtime needs additional states.

TngFlowPortComponent is the reusable visual port shell used by the editor. Foblex connector directives remain private to TngFlowEditorComponent.

Connection routing

Persist path geometry in connection.routing. A connection override wins over options.defaultConnection, which wins over TailNG's compatibility default. Existing definitions remain Bézier unless an application opts into another default.

PathBehavior
straightDirect source-to-target line.
bezierSmooth cubic curve and the backward-compatible default.
orthogonalHorizontal and vertical segments with square corners.
orthogonal-roundedHorizontal and vertical segments using the configured corner radius.
adaptiveA side-aware curve that adapts its control points to endpoint direction.

offset and radius are non-negative canvas values. waypoints are canvas coordinates. Set connectionWaypointsEnabled: true to show editing handles on selected connections in edit mode; inspect and readonly modes only render the saved route.

Connection motion

Set connection motion through presentation.connections. Motion changes only the SVG path presentation, so straight, Bézier, segmented, and adaptive connections retain their existing geometry. Multiple connections can animate at the same time.

PropertyTypeDefaultDescription
motion'none' | 'flow' | 'pulse''none'flow shows a directional travelling dash. pulse emphasizes a waiting or retrying route without implying direction.
motionSpeed'slow' | 'normal' | 'fast''normal'Selects the duration token used by flowing motion.
motionDirection'forward' | 'reverse''forward'Moves from source to target or in the reverse visual direction.
animated(deprecated)booleanfalse Compatibility alias for motion: 'flow'. An explicit motion value takes precedence.

options.motionPreference accepts system, enabled, or disabled. Reduced motion preserves a static emphasized path, so execution state remains visible without movement.

Node template context

Add <ng-template tngFlowNode="node-type"> as editor content. The template replaces only the node body; Flow Editor retains node geometry, drag handling, connectors, selection, and accessibility.

Context valueTypeDescription
$implicit / nodeTngFlowNode<TData>Current domain node.
viewTngFlowResolvedNodeView<TStatus>Resolved structural, controlled selection, presentation, and validation state.
issuesreadonly TngFlowValidationIssue[]Indexed validation issues targeting this node.
modeTngFlowEditorModeThe current edit, inspect, or readonly mode.
readonlybooleanDeprecated convenience value equivalent to mode !== 'edit'.
selectedbooleanCurrent transient selection state.

Connection labels and template context

A connection with label receives a default, visually truncated path label while retaining its complete accessible name. description supplies additional accessible and hover context. Add <ng-template tngFlowConnectionLabel> to replace only the default label content. The earlier tngFlowConnection spelling remains supported. Flow Editor retains the path, true-path midpoint shell, validation badge, selection, reassignment, and accessibility behavior.

Context valueTypeDescription
$implicit / connectionTngFlowConnection<TConnectionData>Current application-owned connection record.
viewTngFlowResolvedConnectionViewResolved runtime, presentation, selection, and validation state.
issuesreadonly TngFlowValidationIssue[]Indexed validation issues targeting this connection.
modeTngFlowEditorModeThe current edit, inspect, or readonly mode.
selectedbooleanCurrent controlled selection state.

The first connection-template contract deliberately omits midpoint. Foblex positions the editor-owned shell at the configured start, center, or end position along the true path for adaptive, Bézier, orthogonal, and straight connections.

Palette items

Apply [tngFlowPaletteItem] to a native button to make a typed catalog item draggable. Bind (tngFlowPaletteItemActivate) to editor.requestNodeCreate(...) for click and keyboard placement at the visible viewport center.

  • tngFlowPaletteItemDisabled disables drag and activation.
  • tngFlowPaletteItemPreview accepts a drag-preview template.
  • tngFlowPaletteItemPlaceholder accepts a source placeholder template.
  • tngFlowPaletteItemPreviewMatchSize controls preview sizing.

The directive and editor exchange a private payload. Foblex external-item data is not part of the TailNG public contract.

Imperative methods

MethodDescription
fitToScreen(animated = true)Fits all rendered nodes into the viewport.
resetViewport(animated = true)Resets scale and centers the flow.
centerNode(nodeId, animated = true)Centers a node by id and returns whether it exists.
revealTarget(target, options?)Centers a validation target and optionally requests controlled selection.
activateNode(nodeId) / activateConnection(connectionId)Emits a generic API activation event when allowed by the current mode.
activateValidationIssue(issueId)Reveals and emits a known validation issue by stable id.
zoomBy(delta)Changes scale while respecting zoom limits.
zoomIn() / zoomOut()Changes scale by the configured zoom step.
screenToCanvas(point)Converts client-screen coordinates into the current canvas coordinate system.
requestNodeCreate(item, position?, source?) Emits a controlled creation request, using viewport center when position is omitted.
requestCommand(command, source?, canvasPosition?) Emits a mode-allowed controlled command request and returns whether it was accepted. Paste and duplicate use the last pointer position or viewport centre when an explicit canvas position is omitted.
requestNodeAlignment(alignment, options?, source?) Measures selected rendered nodes and emits one controlled alignment request in edit mode. Returns whether the request was accepted.
requestNodeDistribution(axis, options?, source?) Measures selected rendered nodes and emits one controlled equal-gap distribution request in edit mode. Returns whether the request was accepted.

Access these through #editor="tngFlowEditor" or viewChild().

Alignment, distribution, and smart guides

alignTngFlowNodes(bounds, alignment, options?) and distributeTngFlowNodes(bounds, axis, options?) are renderer-neutral pure utilities. They accept measured, unscaled bounds and return stable position-only moves without changing the input records. Disabled nodes are ignored; locked nodes are fixed anchors by default or can be excluded with lockedNodes: 'ignore'.

Distribution uses equal edge-to-edge gaps for mixed-size nodes. Grid snapping is applied last, so it deterministically wins when an exact guide or computed gap does not fall on the grid. Editor smart-guide thresholds are specified in CSS-screen pixels and converted for the current canvas scale, keeping the magnetic distance consistent at every zoom level.

Smart guides are disabled by default and render only in edit mode. A configured suppression modifier is sampled on the initiating pointer down for the entire drag. Locked nodes remain selectable TailNG anchors but are excluded from Foblex's movable selection.

Commands and context menus

Command requests carry the current controlled selection and an optional canvas anchor. Copy is available in edit and inspect modes; undo, redo, cut, paste, and duplicate are edit-only. TailNG never reads or writes clipboard payloads and does not maintain history.

Context-menu targets distinguish canvas, node, connection, and port requests. Pointer requests expose browser clientPosition coordinates for overlay placement and transformed canvasPosition coordinates for graph actions. Keyboard requests use the active graph element's visual centre or the viewport centre.

For an unselected selectable node or connection, selectionChange emits first in the same interaction turn. contextMenuRequested then carries that proposed selection even before the application writes it back.

Validation

Supply application issues through validation. Read editor.resolvedValidation() for application and structural issues together, or call validateTngFlowDefinition(definition) before persistence or execution.

  • Empty or duplicate node, port, and connection ids
  • Missing endpoints and input/output direction mismatches
  • Incompatible categories or explicit target allow-lists
  • Disallowed self-connections and port multiplicity violations