Introduce padding setting

+2 votes
asked Feb 14, 2015 in Wanted features by anonymous
Can you please provide an option how to setup padding? It would make some elements more readable. For example, if you use a template class or relation label, it is very close to the border lines so it almost touches it.
commented Feb 15, 2015 by anonymous
Hi, of course. For example, lets say we specify skinparam padding 10. Now whenever a text is being drawn, a 10 pixels are added to its bounding box. Thus, the surrounded elements behave like the text would be bigger. We can discuss how granular this setting would be - for example, members of a class or line labels to be configured separatelly. Or to allow specification of vertical/horizontal padding separatelly. Is that clearer or I should elaborate more? I can also look at the java skinning code, so if you could lead my direction to a correct class responsible for drawing text, it would be very welcomed.

2 Answers

0 votes
answered Feb 15, 2015 by plantuml (295,000 points)

It would be nice if you could give us a real and concrete example so that we can discuss about it.

0 votes
answered Feb 16, 2015 by plantuml (295,000 points)
Ok, we've got the idea.
The real issue here is not only to do the coding, but also to define a simple & consistant syntax.

In the following beta, we have introduced a new skinparam padding:

For example, you can use:
skinparam padding 10

Note that this is really temporary : we are not sure that adding such a parameter is a good idea.
The main issue here is that this parameter is global : it changes padding everywhere.

And to us, having specific parameters for members, classes, labels... would be too complex for the end user.
(There are already too many XXXColor, XXXFontSize params).

Another possibility would have to have some specific syntax in the creole parser itself, but it would mean that you'll have to repeat your setting on every label.

Anyway, the goal of this beta is to let you play with it, to see if other/better ideas will emerge :-)

Thanks again for your suggestions!
commented Sep 11, 2018 by Michael M.
Just stumbled upon this topic. Regarding this part:

> And to us, having specific parameters for members, classes, labels... would be too complex for the end user.
> (There are already too many XXXColor, XXXFontSize params).

I, personally, wouldn't agree. One does not need to remember NodeFontSize, ClassFontSize, PackageFontSize etc. parameters each, just the general naming template. In fact, the great consistent naming scheme introduces an implicit structure to the parameters. Therefore, I find all the parameters very easy to work with and intuitive, and with extensive use of the parameters, I managed to style my PlantUML diagrams such that they are simply... Beautiful :)

And although as a developer I am probably a bit deviated (due to my background in graphics many years ago) by trying to make things pretty, by actually making them as such I managed to convince some of the analysts at my company to switch over from Visio, PowerPoint drawings and Gliffy to PlantUML – and not only for internal documentation but for customer presentations as well. Yup, they are so pretty indeed!

So yeah, the styling is pretty important for me and while it is quite simple-yet-powerful already, I would positively love to be able to set the padding for every type of a node separately. And wouldn't it be possible to have some kind of a simple cascading as to preserve the backwards compatibility with the single global parameter?

The only other thing I'd still love to see, apart from the padding, is to be able to maybe position the inline images a bit better – but this, I figure, would be far more difficult.

I can share some of the diagrams privately to show off how beautiful PlantUML diagrams can be :)
commented Jan 27, 2019 by C in CA
As far a stumbling across this post goes, I'd like to join that I was looking into how to make all beta activity diagram elements share the same minimum width and thought padding may be the key.

I'd love to see a beautiful PlantUML diagram, as I've gotten feedback at work that mine are less than beautiful. ;-[ But they are so quick and easy to make and maintain, I say; while secretly wishing I could make them nicer. I've started fiddling with them to do that, but this lessens the quick and easy part. I think skinparam and !include will allow me to keep the ease of use, if only want I want exists.
commented Apr 30, 2020 by joseluis (160 points)
I also stumbled across this issue, while trying to fix some diagrams that feel too pressed and illegible by virtue of not being able to add some padding to their container.

I completely agree with Michael M, to have this ability would be very useful and not complex to use at all.

best regards
commented May 1, 2020 by plantuml (295,000 points)


I am sure we can help here... but we need some concrete specification :-)

So please :

1) Post a link with a very simple example to start with. For example

2) Write a sentence like : "I want to have a padding of 10 pixel in 'foo1' in the provided example"

This way, we would be able to move on this subject.

Thanks for your help !

commented May 1, 2020 by joseluis (160 points)

Hi, thank you very much for your quick feedback, I just made a simple example:


commented May 5, 2020 by plantuml (295,000 points)

Many thanks for your example : it really helps !

For several reason, we are working on a new style system which will overcome current skinparam limitations (see )

Note that we will still support skinparams (for ascending compatibility), but new features will be only available on style.

So with last beta you can now have :

root {
  BackgroundColor paleGreen
  Padding 0
  Margin 0

title {
  Padding 5 30 80 5
  Margin 40 30 20 10

caption {
  Padding 40 6

document {
  BackgroundColor #DDD
  Margin 10 20 30 40

group {
  BackgroundColor bisque
  FontColor White
  FontSize 32
  LineColor Red

component {
  BackgroundColor cyan
  LineColor blue
  RoundCorner 10
  FontColor BlueViolet
  FontStyle italic
  FontSize 24

interface {
  BackgroundColor greenYellow
  LineColor indigo

arrow {
  LineColor DeepSkyBlue
  FontColor MidnightBlue
  FontSize 10
  FontStyle bold


title padding/margin needs example:
file "file\n" as package {
() " " as acc1
() " " as acc2
Component c2

acc1 ~RIGHT~ acc2 : "access"
acc1 <~RIGHT~ acc2 : "r"
acc1 ~RIGHT~> acc2 : "w"
acc1 <~RIGHT~> acc2 : "rw"

What I'd love to be able to do:
# ±25px bottom padding to //file//
# add ±10px top margin to the diagram
# ±5px left&right padding to the document
# fix the missing space ""here"" (and on 1.)
end caption

Note that point 1 is due to some integration issue between PlantUML and GraphViz, so we turn arround it using a \n (this is a very different issue)

There is not much documentation about this. Tell us what you think about it !


commented May 5, 2020 by joseluis (160 points)
edited May 5, 2020 by joseluis
Hi, I had no idea you were working on this. I love the idea to use CSS for styling, it's much more powerful indeed. The spacing seem to work well.

The only problems I've found are:

1.  using newpage breaks the styling completely for the whole document.

2.  I wasn't able to apply internal padding to any component . Is that going to be possible someday?

thank you!