Package com.vaadin.flow.component.tabs
Class Tab
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.tabs.Tab
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasAriaLabel,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,HasThemeVariant<TabVariant>,HasTooltip,Serializable
@Tag("vaadin-tab")
@JsModule("@vaadin/tabs/src/vaadin-tab.js")
@NpmPackage(value="@vaadin/tabs",
version="25.0.0-alpha17")
public class Tab
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasStyle, HasThemeVariant<TabVariant>, HasTooltip
This component provides an accessible and customizable tab to be used inside
Tabs component.- Author:
- Vaadin Ltd.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets the flex grow property of this tab.final StringgetLabel()Gets the label of this tab.booleanIf true, the item is in selected state.voidsetFlexGrow(double flexGrow) Sets the flex grow property of this tab.final voidSets the label of this tab.voidsetSelected(boolean selected) If true, the item is in selected state.toString()Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
-
Constructor Details
-
Tab
public Tab()Constructs a new object in its default state. -
Tab
Constructs a new object with the given label.- Parameters:
label- the label to display
-
Tab
public Tab(com.vaadin.flow.component.Component... components) Constructs a new object with child components.- Parameters:
components- the child components
-
-
Method Details
-
getLabel
Gets the label of this tab.- Specified by:
getLabelin interfacecom.vaadin.flow.component.HasLabel- Returns:
- the label
-
setLabel
Sets the label of this tab.- Specified by:
setLabelin interfacecom.vaadin.flow.component.HasLabel- Parameters:
label- the label to display
-
setFlexGrow
public void setFlexGrow(double flexGrow) Sets the flex grow property of this tab. The flex grow property specifies what amount of the available space inside the layout the component should take up, proportionally to the other components.For example, if all components have a flex grow property value set to 1, the remaining space in the layout will be distributed equally to all components inside the layout. If you set a flex grow property of one component to 2, that component will take twice the available space as the other components, and so on.
Setting to flex grow property value 0 disables the expansion of the component. Negative values are not allowed.
- Parameters:
flexGrow- the proportion of the available space the tab should take up
-
getFlexGrow
public double getFlexGrow()Gets the flex grow property of this tab.- Returns:
- the flex grow property, or 0 if none was set
-
setSelected
public void setSelected(boolean selected) If true, the item is in selected state.- Parameters:
selected- the boolean value to set
-
isSelected
public boolean isSelected()If true, the item is in selected state.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
If aTabinstance is used insideTabscomponent then selected state is updated based on currently selected tab. So the value is the same asTabs.getSelectedTab().- Returns:
- the
selectedproperty from the webcomponent - See Also:
-
toString
-