elementPorts()
function elementPorts(ports, portStyle?): object;
Expands a map of declarative ElementPorts into a full JointJS ports
object (a groups definition plus the items array). Every port is placed
absolutely under a single 'main' group, keyed by its map id.
Parameters
| Parameter | Type | Description |
|---|---|---|
ports | Record<string, ElementPort> | Map of port id to its ElementPort description. |
portStyle? | Partial<ElementPort> | Shared defaults merged under each port; per-port values win. |
Returns
object
The ports object to assign to an element's attributes.
| Name | Type |
|---|---|
groups | Record<string, dia.Element.PortGroup> |
items | Port[] |
Example
import { elementPorts } from '@joint/react';
// One output port on the right edge, vertically centered.
const ports = elementPorts({ out: { cx: 'calc(w)', cy: 'calc(h/2)' } });