Skip to content

Class Diagrams

Class diagrams are the standard UML notation for documenting object-oriented designs. Use them to visualize classes, their attributes and methods, and the relationships between them.

classDiagram
class Animal {
+String name
+int age
+makeSound()
}
class Dog {
+bark()
}
class Cat {
+meow()
}
Animal <|-- Dog
Animal <|-- Cat

Mermaid Studio provides good support for class diagrams:

  • Syntax highlighting for classes, members, and relationships
  • Code formatting to keep your diagrams tidy
  • Inspections to catch common errors
  • Color provider for customizing diagram colors
  • Live preview to see your diagram as you type
classDiagram
class ClassName {
+publicMember
-privateMember
#protectedMember
~packageMember
+publicMethod()
-privateMethod() returnType
}
SyntaxMeaning
<|--Inheritance
*--Composition
o--Aggregation
-->Association
..>Dependency
..|>Realization
classDiagram
Customer "1" --> "*" Order : places

For full syntax details, see the Mermaid class diagram documentation.