Skip to main content
Version: 4.3

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

ParameterTypeDescription
portsRecord<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.

NameType
groupsRecord<string, dia.Element.PortGroup>
itemsPort[]

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)' } });

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub