Jump To:

  1. ui/tab-manager.TabManager
    1. new exports.TabManager(tablistElement, [options])
    2. tabManager.defaults : TabManagerOptions
    3. tabManager.activate(indexOrId, [triggerActions])
    4. tabManager.activateById(id)
    5. tabManager.updatePanelHeights()
    6. tabManager.destroy()
  2. ui/tab-manager~TabManagerOptions : Object

ui/tab-manager

ui/tab-manager.TabManager

Class for managing Aria tabs

  • Designed to be minimal and lightweight but cover all traditional needs
  • Designed for static / traditional webpages (not SPA)
  • Separated from tabs.js so it can be used by itself as needed (tree-shaking)

Kind: static class of ui/tab-manager

new exports.TabManager(tablistElement, [options])

Param Type Description
tablistElement HTMLElement The element with role="tablist"
[options] Partial.<TabManagerOptions> Configuration options.

tabManager.defaults : TabManagerOptions

Default options for TabManager.

Kind: instance property of TabManager

tabManager.activate(indexOrId, [triggerActions])

Activates a tab. Can be called with an index or a tab ID string.

Kind: instance method of TabManager

Param Type Default Description
indexOrId Number | String The index or ID of the tab to activate.
[triggerActions] Boolean true If false, will not fire onChange or set URL hash.

tabManager.activateById(id)

Public method to activate a tab by its ID.

Kind: instance method of TabManager

Param Type Description
id String The ID of the tab element to activate.

tabManager.updatePanelHeights()

Calculates and applies equal heights to all panels. Waits for images within panels to load before calculating.

Kind: instance method of TabManager

tabManager.destroy()

Removes event listeners, cleans up ARIA attributes, and resets the DOM to its pre-initialized state.

Kind: instance method of TabManager

ui/tab-manager~TabManagerOptions : Object

Kind: inner typedef of ui/tab-manager
Properties

Name Type Default Description
[orientation] String | null "horizontal"
[initialIndex] Number 0 Index to activate on load.
[allArrows] Boolean false Allow all arrow keys to navigate regardless of orientation.
[openByUrlHash] Boolean false Activate tab based on URL hash on initialization.
[setUrlHash] Boolean false Update URL hash when a new tab is activated.
[equalHeights] Boolean false Automatically match the height of all panels.
[onReady] function | null Callback fired after initialization: (instance) => {}
[onChange] function | null Callback fired when tab changes: (active, previous) => {}