elementPort()
function elementPort(port): Port;
Builds a full dia.Element.Port from a declarative ElementPort.
When cx/cy are set the port is placed absolutely; when they are omitted the
port relies on the positioning of whatever group it is placed in.
Parameters
| Parameter | Type | Description |
|---|---|---|
port | ElementPort | The declarative port description to expand. |
Returns
Port
A JointJS port object ready to drop into an element's ports.items.
Example
import { elementPort } from '@joint/react';
// Absolute placement via calc() expressions, relative to the element size.
const outlet = elementPort({ cx: 'calc(w)', cy: 'calc(h/2)', color: 'red' });
// No cx/cy: the port group decides where it sits.
const inlet = elementPort({ shape: 'rect', width: 12, height: 12 });