How to toggle all text annotations

Hi everyone,

I am looking for toggle all text annotations programmatically.

I have added button, so on button click, all text annotations should be hide/show.

Is there any way to achieve this. Please suggest some help

1 Like

You can add/remove/toggle CSS classes on every element:

canvas.addMarker(myElement, 'hidden');

See: https://github.com/bpmn-io/diagram-js/blob/master/lib/core/Canvas.js#L374