Right Vaadin Tree Alignment

By default, the Vaadin Tree component is left-aligned: the roots on the left and the children move to the right.

+ root
|---child
|-----grandchild
|-----grandchild

Is it possible to set the alignment to right-to-left: roots on the right and children moving to the left? Also expand / collapse triangles should be on the right.

           root+
       child---|
grandchild-----|
grandchild-----|
+4
source share
1 answer

Yes it is possible. You can do it with styles. I wrote a simple solution for the Valo theme (another theme may have different styles). I hope I haven’t forgotten anything.

.v-tree.rtl-tree {
  direction: rtl;
  .v-tree-node-caption {
    span {
      padding-left: 28px;
      text-align: right;
    }
    .v-icon {
      padding-left: 0;
    }
  }
  .v-icon + span {
    margin-right: 7px;
  }
  .v-tree-node::before {
    right: 19px;
  }
  .v-tree-node.v-tree-node-root::before {
    right: 0; // special for root node
  }
  .v-tree-node-children {
    padding-right: 19px;
  }
}
+1
source

Source: https://habr.com/ru/post/1652010/


All Articles