Class Tabs
- All Implemented Interfaces:
Iterable<Tab>, Attachable, ElementAttributeMethods<HTMLElement, Tabs>, ElementClassListMethods<HTMLElement, Tabs>, ElementConsumerMethods<HTMLElement, Tabs>, ElementContainerMethods<HTMLElement, Tabs>, ElementEventMethods<HTMLElement, Tabs>, ElementIdMethods<HTMLElement, Tabs>, ElementQueryMethods<HTMLElement>, HTMLElementAttributeMethods<HTMLElement, Tabs>, HTMLElementDataMethods<HTMLElement, Tabs>, HTMLElementStyleMethods<HTMLElement, Tabs>, HTMLElementVisibilityMethods<HTMLElement, Tabs>, IsElement<HTMLElement>, TypedBuilder<HTMLElement, Tabs>, Component, Expandable<HTMLElement, Tabs>, HasItems<HTMLElement, Tabs, Tab>, Modifiers.Box<HTMLElement, Tabs>, Modifiers.Fill<HTMLElement, Tabs>, Modifiers.PageInsets<HTMLElement, Tabs>, Modifiers.Secondary<HTMLElement, Tabs>, Modifiers.Vertical<HTMLElement, Tabs>
public class Tabs
extends BaseComponent<HTMLElement, Tabs>
implements Attachable, Modifiers.Box<HTMLElement, Tabs>, Expandable<HTMLElement, Tabs>, Modifiers.Fill<HTMLElement, Tabs>, HasItems<HTMLElement, Tabs, Tab>, Modifiers.PageInsets<HTMLElement, Tabs>, Modifiers.Secondary<HTMLElement, Tabs>, Modifiers.Vertical<HTMLElement, Tabs>
Tabs allow users to navigate between views within the same page or context.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdds an item to the component.<T> TabsAdds a collection of items to the component.ariaAddLabel(String label) Aria-label for the add button.Provides an accessible label for the tabs.ariaOverflowLabel(String label) The aria label applied to the button which toggles the tab overflow menuariaScrollBackLabel(String label) Aria-label for the back scroll buttonariaScrollForwardLabel(String label) Aria-label for the forward scroll buttonariaToggleLabel(String label) Aria-label for the expandable togglevoidattach(MutationRecord mutationRecord) box(boolean box) Adds/removes modifier(box)voidclear()Clears all items from the component.voidvoidcloseable(CloseHandler<Tab> closeHandler) voidcollapse(boolean fireEvent) booleanChecks whether the component contains an item associated with the given identifier.voiddetach(MutationRecord mutationRecord) voidexpand(boolean fireEvent) expandable(Breakpoints<ExpandableModifier> expandable) Enable expandable vertical tabs at various breakpoints (Modifiers.Vertical.vertical()should be set to true for this to work).expandable(ExpandableModifier expandable) Same asexpandable(breakpoints(default_, expandable))booleanexpanded()fill(boolean fill) Adds/removes modifier(fill)initialSelection(String identifier) inset(Breakpoints<Inset> inset) Insets at various breakpoints.Same asinset(breakpoints(default_, inset))booleanisEmpty()Checks whether the collection of items in the component is empty.Retrieves the item associated with the specified identifier from the component.iterator()Same as noBorderBottom(true)noBorderBottom(boolean noBorderBottom) Disables border bottom tab styling on tabs.By default, the first tab is selected initially.Callback for the 'add' button.onAdd(AddItemHandler<Tabs, Tab> onAdd) Registers a callback to be invoked whenever a new item is added to the component.onClose(CloseHandler<Tab> closeHandler) onRemove(RemoveItemHandler<Tabs, Tab> onRemove) Registers a callback to be invoked whenever an item is removed from the component.onSelect(SelectHandler<Tab> selectHandler) onToggle(ToggleHandler<Tabs> toggleHandler) onUpdate(UpdateItemHandler<Tabs, Tab> onUpdate) Registers a callback to be invoked whenever an item is updated in the component.Flag which places overflowing tabs into a menu triggered by the last tab.overflowHorizontal(String overflowText) Flag which places overflowing tabs into a menu triggered by the last tab.pageInsets(boolean pageInsets) Adds/removes modifier(pageInsets)voidremoveItem(String identifier) Removes an item from the component based on the provided identifier.secondary(boolean secondary) Enables secondary styling to the tab componentvoidvoidvoidvoidSame as showTabCount(true)showTabCount(boolean showTabCount) Flag which shows the count of overflowing tabs when enabledintsize()Retrieves the total number of items currently contained in the component.subtab()Same as subtab(true)subtab(boolean subtab) Adds/removes modifier(subtab)static Tabstabs()static <E extends HTMLElement>
Tabstabs(HTMLContainerBuilder<E> builder) that()toggleText(String text) Text that appears in the expandable toggle.voidupdateItem(Tab item) Updates an existing item in the component.vertical(boolean vertical) Adds/removes modifier(vertical)Methods inherited from class BaseComponent
componentType, element, registerComponentMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ElementAttributeMethods
aria, aria, aria, attr, attr, attr, role, roleMethods inherited from interface ElementClassListMethods
classList, classList, css, toggle, toggle, toggleMethods inherited from interface ElementConsumerMethods
apply, runMethods inherited from interface ElementContainerMethods
add, add, add, add, addAll, addAll, addAll, addAll, addAll, addAllMethods inherited from interface ElementEventMethods
on, on, onMethods inherited from interface ElementIdMethods
id, uniqueIdMethods inherited from interface ElementQueryMethods
closest, querySelector, querySelectorAllMethods inherited from interface Expandable
collapse, expand, toggle, toggleMethods inherited from interface HasItems
addItem, items, replaceItemElement, updateItem, updateItemMethods inherited from interface HTMLElementAttributeMethods
titleMethods inherited from interface HTMLElementDataMethods
data, dataMethods inherited from interface HTMLElementVisibilityMethods
hiddenMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Modifiers.Box
boxMethods inherited from interface Modifiers.Fill
fillMethods inherited from interface Modifiers.PageInsets
pageInsetsMethods inherited from interface Modifiers.Secondary
secondaryMethods inherited from interface Modifiers.Vertical
vertical
-
Method Details
-
tabs
-
tabs
-
attach
- Specified by:
attachin interfaceAttachable
-
detach
- Specified by:
detachin interfaceAttachable
-
addItems
Description copied from interface:HasItemsAdds a collection of items to the component. The method applies the provided function to each item in the given iterable to transform it into a subcomponent, which is then added to the component.- Specified by:
addItemsin interfaceHasItems<HTMLElement, Tabs, Tab>- Type Parameters:
T- the type of the items in the iterable- Parameters:
items- the iterable collection of items to be addeddisplay- the function used to transform each item into a subcomponent- Returns:
- the builder instance after adding the items
-
add
-
box
Description copied from interface:Modifiers.BoxAdds/removes modifier(box)- Specified by:
boxin interfaceModifiers.Box<HTMLElement, Tabs>
-
closeable
-
closeable
-
expandable
Same asexpandable(breakpoints(default_, expandable)) -
expandable
Enable expandable vertical tabs at various breakpoints (Modifiers.Vertical.vertical()should be set to true for this to work). -
fill
Description copied from interface:Modifiers.FillAdds/removes modifier(fill)- Specified by:
fillin interfaceModifiers.Fill<HTMLElement, Tabs>
-
inset
-
inset
Insets at various breakpoints. -
noBorderBottom
Same as noBorderBottom(true) -
noBorderBottom
Disables border bottom tab styling on tabs. Defaults to false. To remove the bottom border, set this prop to true. -
pageInsets
Description copied from interface:Modifiers.PageInsetsAdds/removes modifier(pageInsets)- Specified by:
pageInsetsin interfaceModifiers.PageInsets<HTMLElement, Tabs>
-
overflowHorizontal
Flag which places overflowing tabs into a menu triggered by the last tab. Unlike other flags, this can only be turned on, but not off. -
overflowHorizontal
-
noInitialSelection
By default, the first tab is selected initially. Call this method to disable thi default behaviour. -
initialSelection
-
secondary
Enables secondary styling to the tab component- Specified by:
secondaryin interfaceModifiers.Secondary<HTMLElement, Tabs>
-
showTabCount
Same as showTabCount(true) -
showTabCount
Flag which shows the count of overflowing tabs when enabled -
subtab
Same as subtab(true) -
subtab
Adds/removes modifier(subtab) -
toggleText
-
vertical
Description copied from interface:Modifiers.VerticalAdds/removes modifier(vertical)- Specified by:
verticalin interfaceModifiers.Vertical<HTMLElement, Tabs>
-
that
- Specified by:
thatin interfaceTypedBuilder<HTMLElement, Tabs>
-
ariaLabel
-
ariaAddLabel
-
ariaScrollBackLabel
-
ariaScrollForwardLabel
-
ariaOverflowLabel
-
ariaToggleLabel
-
onAdd
Description copied from interface:HasItemsRegisters a callback to be invoked whenever a new item is added to the component.- Specified by:
onAddin interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
onAdd- aAddItemHandlerthat takes the builder instance and the item being added as arguments- Returns:
- the builder instance after adding the callback
-
onAdd
-
onClose
-
onUpdate
Description copied from interface:HasItemsRegisters a callback to be invoked whenever an item is updated in the component.- Specified by:
onUpdatein interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
onUpdate- aUpdateItemHandlerthat takes the component, the previous state of the item, and the updated state of the item as arguments- Returns:
- the builder instance after adding the callback
-
onRemove
Description copied from interface:HasItemsRegisters a callback to be invoked whenever an item is removed from the component.- Specified by:
onRemovein interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
onRemove- aRemoveItemHandlerthat takes the component and the item being removed as arguments- Returns:
- the builder instance after adding the callback
-
onSelect
-
onToggle
-
expanded
public boolean expanded()- Specified by:
expandedin interfaceExpandable<HTMLElement, Tabs>- Returns:
trueif the element's class list has the modifierClasses.expanded,falseotherwise.
-
collapse
public void collapse(boolean fireEvent) - Specified by:
collapsein interfaceExpandable<HTMLElement, Tabs>
-
expand
public void expand(boolean fireEvent) - Specified by:
expandin interfaceExpandable<HTMLElement, Tabs>
-
close
-
close
-
select
-
select
-
select
-
select
-
currentTab
-
tab
-
iterator
-
size
-
isEmpty
-
contains
Description copied from interface:HasItemsChecks whether the component contains an item associated with the given identifier.- Specified by:
containsin interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
identifier- the identifier of the item to be checked- Returns:
- true if the component contains an item associated with the provided identifier, false otherwise
-
item
Description copied from interface:HasItemsRetrieves the item associated with the specified identifier from the component.- Specified by:
itemin interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
identifier- the identifier of the item to be retrieved- Returns:
- the item associated with the given identifier, or
nullif no item is found
-
updateItem
Description copied from interface:HasItemsUpdates an existing item in the component.- Specified by:
updateItemin interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
item- the item to be updated
-
removeItem
Description copied from interface:HasItemsRemoves an item from the component based on the provided identifier.- Specified by:
removeItemin interfaceHasItems<HTMLElement, Tabs, Tab>- Parameters:
identifier- the identifier of the item to be removed
-
clear
public void clear()Description copied from interface:HasItemsClears all items from the component. This method removes any existing items within the component, leaving it empty. Any associated or registered callbacks related to the removal of items may be invoked as part of this operation.- Specified by:
clearin interfaceHasItems<HTMLElement, Tabs, Tab>
-