Labels and Cardinalities for Relationships
So far, you have learned how to define your classes, add their members, and even establish relations among the different classes in your class diagram. Now, you may be wondering: Wouldn't it add more clarity to relationships if you could add a label or specific text on top of the connecting lines between the two classes? Well, that is what you will learn in this section, and along with that, you will learn about multiplicity in relationships and how to use them in Mermaid.
Adding Labels
Labels are helper texts that adds more clarity and specifies the nature of relationships. Mermaid does allow you to add a specific piece of text in the center of the connecting line between two classes. You just need to specify the label text in the proper syntax to Mermaid, and it will automatically calculate the correct position in the diagram for that label and render it. Let's look at the syntax for adding labels to relationships in a class...