How to add a tooltip using matTooltip or overlays


I wanted to add a simple tooltip to my BpmnJSViewer.
I want the tooltip to disappear, so overlays was not a solution for me.

I was trying something like this:
BpmnJSViewer.get(‘elementRegistry’)get(elementId).matTooltip = element.tooltipText;

But it’s not working.

How can I add tooltips to a specific elementId?


You can use Tooltip module for that. It’s a built-in module for diagram-js, diagram-js is used by bpmn-js.

Here’s a working example:

I’m getting.

ERROR Error: No provider for “tooltips”! (Resolving: tooltips)
at error (bpmn-navigated-viewer.development.js:1775)

For this line:
const tooltips = this.bpmnJS.get(‘tooltips’);

I tired this with the BpmnJSViewer (not the Modeler). With the modeller it works, but the viewer doesn’t have any tooltip option.

So, therefore, this module is not available for the Viewer


As Niklas mentioned, this module is not available for Viewer by default, however you can add it to your Viewer as an additional module.

I’ve updated the example, as you can see it works now with the Viewer as well: