Adding label on a shape

Hi,

I am only using diagram-js library, without bpmn-js.
How can I add a label to a shape when creating it?
Same question for adding text to a new created label.

Thank you

Welcome @Bianca!

The way bpmn-js handles it (which will be no different in diagram-js only) is that additional shapes, label shapes, are being added to the diagram on import. From the diagrams perspective these are normal shapes such as any other.

Another thing that diagram-js does not offer out of the box but bpmn-js adds on top is label editing. That component adds the following capability:

  • Hook up with diagram-js-direct-editing to make an element editable
  • Trigger direct editing
  • Receive the edited results and update the model

If you share concrete code snippets or a place were you’re stuck right now we may be able to help you in a mode hands-on fashion.

Best,
Nico