How to add more padding / whitespace to tree?

How do I add more whitespace around the elements in the tree? I tried tree.setItemStyle() but there was no difference in appearance. Any thoughts?



You can use setItemTopOffset() method. Please check example here … ffset.html

Thanks for showing me that, Olga.

In the weekend I also played with setting


for the enclosing element (in my case a tag). The result is more whitespace around each item in the tree, see attached screenshot.

Quick update: after experimenting some more with adding whitespace around the nodes in a tree, I found that adding


around the enclosing element, like I described in the last post, is not ideal. It makes the nodes in the tree component move slightly when the user expands and collapses nodes. Olga’s suggestion of using the setItemTopOffset() method (or setting “topoffset” in XML/JSON) works better.