Tabs

Tabs

new Tabs(element, options)

Source:
Parameters:
Name Type Description
element HTMLElement

DOM element for component instantiation and scope

options Object
Properties
Name Type Description
containerSelector String

Selector for container element

listSelector String

Selector for list element

listItemsSelector String

Selector for tabs element

moreButtonSelector String

Selector for more button element

moreLabelSelector String

Selector for more button label element

prevSelector String

Selector for prev element

nextSelector String

Selector for next element

attachClickListener Boolean
attachResizeListener Boolean

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:
Name Type Description
currentTab HTMLElement

tab element

direction string

key arrow direction

closeMoreDropdown(e)

Description:
  • Close the dropdown.

Source:
Parameters:
Name Type Description
e Event

destroy()

Description:
  • Destroy component.

Source:

handleClickOnToggle()

Description:
  • Toggle the "more" dropdown.

Source:

handleKeyboardOnTabs(e)

Source:
Parameters:
Name Type Description
e Event

handleResize()

Description:
  • Trigger events on resize.

Source:

init()

Description:
  • Initialise component.

Source:

moveFocus(currentTab)

Source:
Parameters:
Name Type Description
currentTab HTMLElement

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:
Name Type Description
eventName string

The name of the event to listen for.

callback function

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:
Name Type Description
dir int | string

tabsKeyEvents()

Description:
  • Bind key events on tabs for accessibility.

Source:

trigger(eventName, eventData)

Description:
  • Trigger a component event.

Source:
Parameters:
Name Type Description
eventName string

The name of the event to trigger.

eventData any

Data associated with the event.

(static) autoInit(root) → {Tabs}

Source:
Parameters:
Name Type Description
root HTMLElement

DOM element for component instantiation and scope

Returns:

An instance of Tabs.

Type
Tabs