Hide single tab on tabsheet

I have a screen in which a number of tabs in the tabsheet are optional. It is even possible that only one tab is left visible. In this case, it would be very nice if the tabs would not be visible at all.

I can imagine that I could set styling to the tabsheet that would hide the tab but is there any other way to do such a thing? Thanks for any ideas.
-b

Solved it like this:

        // Check number of tabs visible. If only one, hide tab container alltogether
        int i =0;
        for (TabSheet.Tab t : tabs.getTabs()) {
            if (t.isVisible())
                i += 1;
        }
        if (i == 1)
            tabs.setStyleName("hide-tabs");

And styling:

.hide-tabs {
    margin-top: -12px; /* assumes the top margin is set for the visible tab */
    .v-tabsheet-tabcontainer {
        display: none;
    }
}
2 Likes

Hello @b.tel

Considering the solution you want to hide the following component part, am I right?

image

Unfortunately there is no any API to manage this behavior and the only way to achive it is to add custom style as you do.

Regards,
Daniil

Yeah - thought so.

Thanks for follow-up.
-b