Component diagrams: interfaces and dependencies
简介 / Introduction
Component diagrams are a core part of architecture documentation, showing module boundaries, interface contracts, and dependency relationships. PlantUML has native component and interface syntax with multiple arrow styles; Mermaid simulates the same using class diagrams with <<interface>> markers. This article contrasts both engines using a single scenario — an OrderService depending on PaymentGateway and NotificationSvc via typed interfaces.
PlantUML Version
1 | @startuml |
componentStyle uml2 switches to rectangular component boxes; ..|> denotes implementation; the hidden separator -[hidden]- aligns the two interfaces horizontally without drawing a visible arrow.
Mermaid Version
1 | classDiagram |
Mermaid has no dedicated component diagram — <<interface>> inside a class declaration is the conventional substitute; ..> draws a dashed arrow (implements) and --> draws a solid arrow (dependency).
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Native component syntax | ✅ component + interface |
❌ Uses class diagram as workaround |
| Interface marker | interface "Name" |
<<interface>> inside class |
| Implements arrow | ..|> |
..> |
| Dependency arrow | --> |
--> |
| Hidden separator line | -[hidden]- |
Not supported; needs CSS adjustment |
小结 / Wrap-up
PlantUML’s component diagram is purpose-built for interface and dependency visualization, making the diagram semantically precise. Mermaid achieves the same visual outcome via class diagrams with <<interface>> conventions, trading specificity for broader Markdown compatibility. Choose PlantUML for architecture-grade diagrams with full component notation; choose Mermaid when the diagram must render in any Markdown environment without a dedicated PlantUML server.
- Title: Component diagrams: interfaces and dependencies
- Author: puml.online
- Created at : 2026-10-17 01:01:02
- Updated at : 2026-10-19 01:07:19
- Link: https://puml.online/blog/component-diagram-interfaces-en/
- License: This work is licensed under CC BY-NC-SA 4.0.