Skip to main content

LabelOverlayOptions

Options for a label overlay

Extends

Properties

attributes?

optional attributes: Record<string, string>

Optional custom attributes to write to the overlay's element.

Inherited from

OverlayOptions.attributes


backgroundStyle?

optional backgroundStyle: LabelBackgroundStyle

Optional style for the label's background.


cssClass?

optional cssClass: string

Optional CSS class(es) to add to the overlay's element.

Inherited from

OverlayOptions.cssClass


direction?

optional direction: number

1 to point forwards (the default), -1 to point backwards. Only taken into consideration in some overlay types.

Inherited from

OverlayOptions.direction


events?

optional events: Record<OverlayEvents, (value, event?) => any>

Optional event handlers to attach to the overlay.

Inherited from

OverlayOptions.events


font?

optional font: FontSpec

Optional spec for the font to use on this label.


id?

optional id: string

Optional ID for the overlay. Can be used to retrieve the overlay from a connection.

Inherited from

OverlayOptions.id


label

label: string | Function

String, or a function returning a string, for the label.


labelLocationAttribute?

optional labelLocationAttribute: string

Optional name of the attribute that identifies this overlay's location on the path. Defaults to location.


location?

optional location: number

Defaults to 0.5. See docs.

Inherited from

OverlayOptions.location


rotatable?

optional rotatable: boolean | "strict" | "legible"

Sets whether the label can be rotated to match the gradient of the connector at that location at which it is positioned. If you supply boolean true here, the label will be made rotatable, in "legible" mode - in which VisuallyJs ensures that the label is legible by avoiding rotating the text so that it is upside down or otherwise awkward to read. You can set "strict" mode, which will rotate the label to the appropriate angle regardless of whether or not it will make the label difficult to read. If you supply boolean false, the label will not be rotatable in any situation.


useHTMLElement?

optional useHTMLElement: boolean

Whether or not to use an HTML element. Defaults to false (uses an SVG element)


visibility?

optional visibility: OverlayVisibility

Whether the overlay is always visible, or only on hover. Defaults to OVERLAY_VISIBILITY_ALWAYS.

Inherited from

OverlayOptions.visibility