| Let's have few examples. Components must be bracketed. You can also use the |
component keyword to define a component. In this case the brackets can be omitted, but only if the component name does not include white-space or special characters. You can define an alias, using the
as keyword. This alias will be used later, when defining relations.
Naming exceptions Note that component names starting with
$ cannot be hidden or removed later, because
remove command will consider the name a
$tag instead of a component name. To later remove such component they must have an alias or must be tagged.
Interface can be defined using the
() symbol (because this looks like a circle). You can also use the
interface keyword to define an interface. And you can define an alias, using the
as keyword. This alias will be used latter, when defining relations. We will see latter that interface definition is optional.
Links between elements are made using combinations of dotted line (
..), straight line (
--), and arrows (
You can use the
note left of ,
note right of ,
note top of ,
note bottom of keywords to define notes related to a single object. A note can be also defined alone with the
note keywords, then linked to other objects using the
.. symbol or whatever arrow symbol (
--, ...). Another note example:
You can use several keywords to group components and interfaces together:
By default, links between classes have two dashes
-- and are vertically oriented. It is possible to use horizontal link by putting a single dash (or dot) like this: You can also change directions by reversing the link: It is also possible to change arrow direction by adding
down keywords inside the arrow: You can shorten the arrow by using only the first character of the direction (for example,
-d- instead of
-down-) or the two first characters (
-do-). Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking. And with the
left to right direction parameter:
By default (from v1.2020.13-14), UML2 notation is used.
skinparam componentStyle uml1 command is used to switch to UML1 notation.
skinparam componentStyle rectangle command is used to switch to rectangle notation (without any UML notation).
It is possible to put description on several lines using square brackets.
You can specify a color after component definition.
You can use sprites within stereotype components. You can use the skinparam command to change colors and fonts for the drawing. You can use this command : You can define specific color and fonts for stereotyped components and interfaces.
- By default (or with
skinparam componentStyle uml2), you have an icon for component
[Ref. 10798] By default, all components are displayed: But you can:
- If you want to suppress it, and to have only the rectangle, you can use
skinparam componentStyle rectangle
hide @unlinked components:
[Ref. QA-11052] You can put
remove @unlinked components:
$) on components, then remove, hide or restore components either individually or by tags. By default, all components are displayed: But you can:
remove $tag13 components:
remove $tag13 and restore $tag1 components:
[Ref. QA-7337 and QA-11052]
remove * and restore $tag1 components:
Simple example[Ref. QA-15481] For another example, see on JSON page. You can added port with
Mixing PortIn & PortOut