Tabs

Tabs

new Tabs(element, options)

Source:
Parameters:
NameTypeDescription
elementHTMLElement

DOM element for component instantiation and scope

optionsObject
Properties
NameTypeDescription
containerSelectorString

Selector for container element

listSelectorString

Selector for list element

listItemsSelectorString

Selector for tabs element

moreButtonSelectorString

Selector for more button element

moreLabelSelectorString

Selector for more button label element

prevSelectorString

Selector for prev element

nextSelectorString

Selector for next element

attachClickListenerBoolean
attachResizeListenerBoolean

Classes

Tabs

Members

onToggle

Description:
  • Sets the callback function to be executed on toggle.

Source:

Sets the callback function to be executed on toggle.

onToggle

Description:
  • Gets the callback function set for toggle events.

Source:

Gets the callback function set for toggle events.

Methods

arrowFocusToTab(currentTab, direction)

Source:
Parameters:
NameTypeDescription
currentTabHTMLElement

tab element

directionstring

key arrow direction

closeMoreDropdown(e)

Description:
  • Close the dropdown.

Source:
Parameters:
NameTypeDescription
eEvent

destroy()

Description:
  • Destroy component.

Source:

handleClickOnToggle()

Description:
  • Toggle the "more" dropdown.

Source:

handleKeyboardOnTabs(e)

Source:
Parameters:
NameTypeDescription
eEvent

handleResize()

Description:
  • Trigger events on resize.

Source:

init()

Description:
  • Initialise component.

Source:

moveFocus(currentTab)

Source:
Parameters:
NameTypeDescription
currentTabHTMLElement

tab element

on(eventName, callback) → {void}

Description:
  • Register a callback function for a specific event.

Source:
Example
// Registering a callback for the 'onToggle' event
inpage.on('onToggle', (event) => {
  console.log('Toggle event occurred!', event);
});
Parameters:
NameTypeDescription
eventNamestring

The name of the event to listen for.

callbackfunction

The callback function to be invoked when the event occurs.

Returns:
Type
void

shiftTabs(dir)

Description:
  • Action to shift next or previous tabs on mobile format.

Source:
Parameters:
NameTypeDescription
dirint | string

tabsKeyEvents()

Description:
  • Bind key events on tabs for accessibility.

Source:

trigger(eventName, eventData)

Description:
  • Trigger a component event.

Source:
Parameters:
NameTypeDescription
eventNamestring

The name of the event to trigger.

eventDataany

Data associated with the event.

(static) autoInit(root) → {Tabs}

Source:
Parameters:
NameTypeDescription
rootHTMLElement

DOM element for component instantiation and scope

Returns:

An instance of Tabs.

Type
Tabs