Tabs CloseHandler in Vaadin 14

In version 8 I used a TabSheet CloseHandler to manage when user closes the tab using X.
How can I handle this in Vaadin 14 ?
Tks

I didn’t find also any setClosable method is it default ?
Tks

Hi Tullio

Neither Tabs nor Tab have any open/close functionality out of the box.
But since the content of a Tab can be any Component, you can add your own Close Button to each tab and implement setClosable yourself by showing/hiding that close button.

Tks.
May I add the x button to the tab label in order to emulate every standard Tab ?
Tks

May I add the x button to the tab label in order to emulate every standard Tab ?

Yes, that should be relatively easy as you can add a component in Tab, i.e. you can have there link and a button wrapped in a layout, here is a rudimentary example of removable Tabs.

https://github.com/TatuLund/devday-demo-flow/blob/master/src/main/java/com/vaadin/devday/demo/MainLayout.java#L82

the content of a Tab can be any Component

… With that I meant the “Label” content. You can have a HorizontalLayout as the label, consisting of a Span and the x button.

Tabs myTabs = new Tabs();

Tab closableTab = new Tab();
Button closeTabButton = new Button(VaadinIcon.CLOSE.create(), click -> {
	myTabs.remove(closableTab)
});
HorizontalLayout = tabLabel = new HorizontalLayout(new Span("Test"), closeTabButton);
closableTab.add(tabLabel);

myTabs.add(closableTab);

I don’t understand Your solution.
I don’t want to have the button in the tab body but in the tab label and add, if I understand correctly, add a component in the tab body.
Am I wrong ?
Tks

There has been a misunderstanding. A Tab does not have a “body”, it only has a “label”, which can be any component/layout.
What I was suggesting would put the button inside the label, together with a text.

Please try it out and look what it does, or see in the [examples]
(https://vaadin.com/components/vaadin-tabs/java-examples) (example “Tabs with custom content”).