A controller class for managing tabbed navigation within an Application instance.

<!-- Example HTML -->
<nav class="tabs" data-group="primary-tabs">
<a class="item" data-tab="tab1" data-group="primary-tabs">Tab 1</li>
<a class="item" data-tab="tab2" data-group="primary-tabs">Tab 2</li>
</nav>

<section class="content">
<div class="tab" data-tab="tab1" data-group="primary-tabs">Content 1</div>
<div class="tab" data-tab="tab2" data-group="primary-tabs">Content 2</div>
</section>

Activate tab control in JavaScript

const tabs = new foundry.applications.ux.Tabs({navSelector: ".tabs", contentSelector: ".content", initial: "tab1"});
tabs.bind(html);

Constructors

Properties

_content: null | HTMLElement = null

A reference to the HTML container element of the tab content

_contentSelector: string

The CSS selector used to target the tab content element

_nav: null | HTMLElement = null

A reference to the HTML navigation element the tab controller is bound to

_navSelector: string

The CSS selector used to target the tab navigation element

active: string

The value of the active tab

callback: null | Function

A callback function to trigger when the tab is changed

group: string

The name of the tabs group

Methods

  • Activate a new tab by name

    Parameters

    • tabName: string
    • triggerCallback: boolean = {}

    Returns void

  • Bind the Tabs controller to an HTML application

    Parameters

    • html: HTMLElement

    Returns void

  • Protected

    Handle click events on the tab navigation entries

    Parameters

    • event: PointerEvent

      A left click event

    Returns void