Connection rules let you restrict which inputs can accept a connection from a specific output or outlet.
Instead of letting users connect anything to anything, you can declare an allow‑list directly on the source connector and the library will:
Connection rules are a UX guardrail. Your app should still validate and persist the final graph state.
Rules are defined on source connectors:
You provide:
fCanBeConnectedInputs: string[]During drag-to-connect, the library checks each candidate target fNodeInput and considers it connectable when either matches:
fInputIdfInputCategory (if you use categories)Only input-approve can be targeted.
Only inputs with fInputCategory="A" are valid targets.
fCanBeConnectedInputsfCanBeConnectedInputs is a simple allow-list of strings.
Each string can be interpreted as either:
fInputId)fInputCategory)Because both are plain strings, you should adopt a convention to avoid accidental collisions
(when some fInputId equals a category name).
Use prefixes:
id:<inputId> — for a specific inputcat:<category> — for a categoryExample:
And on the targets:
You can also enforce “no overlap” by policy:
input:<name> or in-<number>CAT_<name> or type:<name>The key point is: make ids and categories visually distinct so allow-lists are readable and safe.
fCanBeConnectedInputs: string[];[fNodeOutput] and [fNodeOutlet].fInputId: InputSignal<string>;fInputCategory: InputSignal<string | undefined>; (optional)fCreateConnection from f-flow[fDraggable]During drag-to-connect, the library applies state classes so you can clearly communicate rules:
.f-connector-connectable - marks valid targets during drag.f-node-input-not-connectable / .f-node-output-not-connectable - blocked ports(Exact styling is up to you; the library keeps defaults minimal.)
fCanBeConnectedInputs is empty or undefined, there is no allow-list restriction.[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connectors/connection-rules/connection-rules.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connectors/connection-rules/connection-rules.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/connectors/connection-rules/connection-rules.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss