Skip to main content
Version: 4.3

NavigatorLinkStyleCallback

type NavigatorLinkStyleCallback<T> = (payload) => NavigatorLinkStyle;

Per-link styling hook for the mini-map. Receives the link's dia.Link model and its resolved record, and returns a style map (NavigatorLinkStyle) applied to the rendered <path> β€” handy for coloring or dashing links based on their data. Returned values are applied as inline CSS, except d, which is set as an attribute (the CSS d property is not reliably supported across browsers).

Type Parameters​

Type ParameterDescription
TShape of the custom data payload carried on the link.

Parameters​

ParameterType
payload{ model: dia.Link; record: Computed<LinkRecord<T>>; }
payload.modeldia.Link
payload.recordComputed<LinkRecord<T>>

Returns​

NavigatorLinkStyle

Example​

import type { NavigatorLinkStyleCallback } from '@joint/react-plus';

const styleBySelection: NavigatorLinkStyleCallback<{ selected: boolean }> = ({ record }) => ({
stroke: record.data.selected ? '#2980b9' : '#bdc3c7',
});

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub