I want to remove connection programmically with its id. Not clicking trash icon.
In the example: GitHub - bpmn-io/bpmn-js-example-custom-shapes: Creating custom elements in bpmn-js that live outside a BPMN 2.0 diagram.
Modeling#removeElements is your friend.
bpmnjs.get('modeling').removeElements([
bpmnjs.get('elementRegistry').get('foo')
]);