tabs
Basics
Below is a simple example of tabs
:
<tabs id="tabs">
<tab id="tab1" label="Tab One"/>
<tab id="tab2" label="Tab Two"/>
</tabs>
Components can be nested inside tab elements to compose more complex labels:
<tabs>
<tab id="tab3">
<icon icon="HOME"/>
<span text="Home"/>
</tab>
<tab id="tab4">
<icon icon="INFO_CIRCLE"/>
<span text="Information"/>
</tab>
</tabs>
Tab
Individual tabs are defined with the nested tab
elements.
To add |
Attributes
Each tab
element can have the following attributes:
id - classNames - colspan - enabled - flexGrow - label - themeNames - visible
Attributes
id - classNames - colspan - height - maxHeight - maxWidth - minHeight - minWidth - orientation - themeNames - visible - width
Handlers
To generate a handler stub in Jmix Studio, use the Handlers tab of the Jmix UI inspector panel or the Generate Handler action available in the top panel of the view class and through the Code → Generate menu (Alt+Insert / Cmd+N). |
SelectedChangeEvent
io.jmix.flowui.component.tabsheet.JmixTabSheet.SelectedChangeEvent
is fired when another tab is selected.
The following example adds a label when a tab is selected:
@ViewComponent
private VerticalLayout content;
@Subscribe("tabs")
public void onTabsSelectedChange(final Tabs.SelectedChangeEvent event) {
setTabContent(event.getSelectedTab());
}
private void setTabContent(Tab tab) {
content.removeAll();
Label tabLabel = uiComponents.create(Label.class);
if ("tab1".equals(tab.getId().orElse(null))) {
tabLabel.setText("Tab One is selected");
content.add(tabLabel);
} else {
tabLabel.setText("Tab Two is selected");
content.add(tabLabel);
}
}
See Also
See the Vaadin Docs for more information.