How to embed already defined components in a frame

0 votes
asked Oct 26, 2024 in Question / help by woerlz

Hi,

it's probably a trivial question, but anyways. I want to define several components and combine them into frames afterwards.


@startuml

component A
component B{
port C
}

frame "TheFrame" {
B
}

@enduml




How do I insert component B into the frame without defining it within the frame?

Thank you!
woerlz

2 Answers

0 votes
answered Oct 27, 2024 by xiaoqi (700 points)
Hi Woerlz,

In my understanding, when you draw Component Diagram, where you define the component will lead to where is the location of the component, so you can see the difference from below two after you add relations:

1) A -> B still outside of your frame, although your link is within frame

@startuml

component A
component B

frame "TheFrame" {
A -> B
}

@enduml

2) A is outside and B is inside your frame, the link is cross the boundary

@startuml

component A

frame "TheFrame" {
component B
A -> B
}

@enduml

So, for your question, you need to define Component B inside Frame.

Xiaoqi
0 votes
answered Oct 27, 2024 by kirchsth (7,480 points)

Hi @woerlz

if you organize your definitions via include files, then it could be the same Group already defined components - PlantUML Q&A problem. 

I can't make a link to my answer, therefore I copied it here again:

you can use `Including Subpart - !startsub, !endsub, !includesub` and you can include your component
as part of a package too (I checked it in the meantime).

You can find a sample in solution 3 of this comment

BR Helmut

...