Skip to main content
LabelOverlayOptions
Options for a label overlay
NameTypeDescription
attributes?Record<string,string>Optional custom attributes to write to the overlay's element.
backgroundStyle?LabelBackgroundStyleOptional style for the label's background.
cssClass?stringOptional CSS class(es) to add to the overlay's element.
direction?number1 to point forwards (the default), -1 to point backwards. Only taken into consideration in some overlay types.
events?Record<OverlayEvents,(value:any, event:any) => any>Optional event handlers to attach to the overlay.
font?FontSpecOptional spec for the font to use on this label.
id?stringOptional ID for the overlay. Can be used to retrieve the overlay from a connection.
labelstring | FunctionString, or a function returning a string, for the label.
labelLocationAttribute?stringOptional name of the attribute that identifies this overlay's location on the path. Defaults to location.
location?numberDefaults to 0.5. See docs.
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?booleanWhether or not to use an HTML element. Defaults to false (uses an SVG element)
visibility?OverlayVisibilityWhether the overlay is always visible, or only on hover. Defaults to OVERLAY_VISIBILITY_ALWAYS.