Skip to main content
Version: 4.3

linkStyleLine()

function linkStyleLine(style?): Nullable<attributes.SVGAttributes>;

Builds the SVG attrs for a link's visible line from a LinkStyle: stroke color and width, source/target markers, dash pattern, and the line's CSS class. This is the line half of linkStyle; reach for it when you style the line and wrapper selectors separately.

Parameters

ParameterTypeDescription
styleLinkStylelink style to convert to SVG attributes

Returns

Nullable<attributes.SVGAttributes>

SVG attributes for the line selector

Example

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

const style = { color: '#333', width: 2 };
const link = new LinkModel({
source: { id: 'a' }, target: { id: 'b' },
attrs: { line: linkStyleLine(style), wrapper: linkStyleWrapper(style) },
});

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub