How to do Unreal Engine matching?

Is this what you’re talking about?
image

It is worth taking as a basis Drag Drop Operation.

When you press the button, keep the wire color, and when you release it, check if it matches what was there before.
In the “OnPaint” function in the widget, you can draw a line from the start of the wires to the cursor or wire end.