Class Diagram
Last updated:
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.
Syntax Highlighting
Section titled “Syntax Highlighting”Syntax highlighting integrates directly with IntelliJ’s color scheme system, so diagram colors always match your editor theme.
IDE Support
Section titled “IDE Support”Mermaid Studio provides comprehensive support for class diagrams:
- Syntax highlighting for classes, members, and relationships
- Code completion for class syntax and relationship types
- Rename refactoring to update class names across the diagram
- Find usages to locate class references
- Code folding to collapse class definitions
- Formatting to keep your diagrams tidy
- Inspections to catch common errors
- Brace matching for class body navigation
- Code Vision showing relationship counts inline
- Color provider for customizing diagram colors
Quick Syntax Reference
Section titled “Quick Syntax Reference”Defining Classes
Section titled “Defining Classes”classDiagram class ClassName { +publicMember -privateMember #protectedMember ~packageMember +publicMethod() -privateMethod() returnType }Relationships
Section titled “Relationships”| Syntax | Meaning |
|---|---|
<|-- | Inheritance |
*-- | Composition |
o-- | Aggregation |
--> | Association |
..> | Dependency |
..|> | Realization |
Cardinality
Section titled “Cardinality”classDiagram Customer "1" --> "*" Order : placesFor full syntax details, see the Mermaid class diagram documentation.