Skip to content

alejandro-du/paged-tabs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Published on Vaadin  Directory Stars on vaadin.com/directory

paged-tabs

The current Vaadin's Tabs component doesn't include an API to show a Component when a tab is clicked. You have to code the logic to show and hide components depending on the selected tab. This component frees you from implementing such logic. Here's an example:

VerticalLayout container = new VerticalLayout();
PagedTabs tabs = new PagedTabs(container);
tabs.add("Tab caption 1", component1);
tabs.add("Tab caption 2", component2);

Make a tab non-closable as follows:

tabs.add("Closable", new Span("Close me"), false);

Get a Tab reference:

Tab tab = tabs.add("Tab caption", component);

Add a selection listener:

tabs.addSelectedChangeListener(selectedTab -> {
    ...
});

Set a close listener:

tabs.setCloseListener(closableTab, closedTab -> {
    ...
});

Get text by Tab (captions must be unique):

String textOnTab = tabs.getText(tab);

Get Tab by text:

Tab tab = tabs.getTab("Tab caption");

Get Component by tab:

Component component = tabs.getComponent(tab);

Close a tab:

tabs.close(tab);

Select a tab:

tabs.select(tab);

Get selected tab:

Tab tab = tabs.getSelectedTab();

Count tabs:

int count = tabs.count();

About

A tabs component to show a page when a tab is clicked - https://vaadin.com/directory/component/paged-tabs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages