Skip to main content
Version: 4.3

linkStyle()

function linkStyle(style?): Record<string, Nullable<attributes.SVGAttributes>>;

Converts a LinkStyle into the JointJS SVG attrs object a link needs, keyed by the line and wrapper selectors. Use it to set a link's attrs directly, or rely on the style shorthand handled by linkAttributes.

Parameters

ParameterTypeDescription
styleLinkStylelink style to convert to SVG attributes

Returns

Record<string, Nullable<attributes.SVGAttributes>>

An attrs object with line and wrapper entries

Example

import { LinkModel, linkStyle } from '@joint/react';

const link = new LinkModel({
source: { id: 'a' },
target: { id: 'b' },
attrs: linkStyle({ color: '#333', width: 2, targetMarker: 'arrow' }),
});

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub