how to ad a subcomponent to a "long comment" component?

0 votes
asked Oct 5, 2022 in Question / help by boshka (3,940 points)
This page https://plantuml.com/en/component-diagram contains an example of a component with a long comment as follows:

@startuml
component comp1 [
This component
has a long comment
on several lines
]
@enduml

What would be the syntax that adds a subcomponent of the comp1?

1 Answer

0 votes
answered Oct 5, 2022 by The-Lu (64,760 points)

Hello B., and all,

Here is a proposal:

@startuml
component "This component\nhas a long comment\non several lines\n" as C {
  component C1
  file F
  node N
}
@enduml

Enjoy,
If that can help,

Regards.
Th.

commented Oct 5, 2022 by boshka (3,940 points)
edited Oct 5, 2022 by boshka
thank you!

so, from the code perspective the long comment is, in fact, the same as component name/title?

Then the [] notation is just some legacy way to achieve the same?

I was thinking the comment is apart of the title and that you could do something like:

component "Name" as myName [

   Name description

   in the long comment

] {
  component SubComponent1
}
...