Text alignment for components in component diagram

+4 votes
asked May 4, 2020 in Question / help by lp-lima (140 points)
edited May 5, 2020 by lp-lima

Is there a way to set the text alignment for a specific stereotype in component diagrams? Right now, I can only either get everything changed by a global skinparameter, or anything at all. Isn't there a middle ground?

EDIT: inclusion of an example. In the diagram below, I don't know how to centralize / align the text to the left on those components individually.

@startuml
skinparam {
    defaultTextAlignment left
}

skinparam component {
    defaultTextAlignment<<centered>> center
}

component left [
    I wanted this long long long text
    aligned to the left
]

component center<<centered>> [
    I wanted this long long long text
    centered
]


@enduml

2 Answers

0 votes
answered May 5, 2020 by plantuml (295,800 points)
Not sure...

Could you post a simple and short example we could talk about ?

Thanks !
commented May 5, 2020 by lp-lima (140 points)
Added an example to the OP. Thanks!
0 votes
answered Nov 18 by The-Lu (74,900 points)

Hello L.,

FYI that is now fixed and implemented on v1.2024.8 (even since v1.2024.7):

- Thanks PlantUML team for your work.

Here is the corresponding code, with new style feature:

@startuml
<style>
component {
  HorizontalAlignment left
  .centered {
    HorizontalAlignment center
  }
}
</style>

component left [
    I wanted this long long long text
    aligned to the left
]

component center<<centered>> [
    I wanted this long long long text
    centered
]
@enduml

Ref.:

Regards,
Th.

...