Monster.Components.Layout. Tabs

This CustomControl creates a tab element with a variety of options.

You can create this control either by specifying the HTML tag <monster-tabs /> directly in the HTML or using Javascript via the document.createElement('monster-tabs'); method.

<monster-tabs></monster-tabs>

Or you can create this CustomControl directly in Javascript:

import {Tabs} from '@schukai/monster/components/layout/tabs.mjs';
document.createElement('monster-tabs');

Constructor

new Tabs()

A configurable tab control

Since
  • 1.10.0
Example

Create a simple tab control

<monster-tabs>
    <div id="tab1">Tab 1</div>
    <div id="tab2">Tab 2</div>
</monster-tabs>

Members

defaults

To set the options via the html tag the attribute data-monster-options must be used.

To set the options via the html tag the attribute data-monster-options must be used.

Properties
NameTypeDefaultDescription
templatesObject

Template definitions

Properties
NameTypeDescription
mainstring

Main template

labelsObject
Properties
NameTypeDefaultDescription
new-tab-labelstring"New

Tab"

featuresObject
Properties
NameTypeDefaultDescription
openDelaynumber500

Open delay in milliseconds

fetchObject

Fetch see Using Fetch mozilla.org

Properties
NameTypeDefaultDescription
redirectStringerror
methodStringGET
modeStringsame-origin
credentialsStringsame-origin
headersObject{"accept":"text/html"}}
popperObject

PopperJS Options

Properties
NameTypeDefaultDescription
placementstringbottom

PopperJS placement

modifiersArray.<Object>{name:offset}

PopperJS placement

See

(static) instanceSymbol

This method is called by the instanceof operator.

This method is called by the instanceof operator.

Since
  • 2.1.0

Methods

activeTab(idOrName) → {Tabs}

A function that activates a tab based on the provided name.

A function that activates a tab based on the provided name.

The tabs have to be named with the data-monster-name attribute.

Parameters:
NameTypeDescription
idOrNametype

the name or id of the tab to activate

Returns:
  • The current instance
Type: 
Tabs

assembleMethodSymbol()

This method is called internal and should not be called directly.

This method is called internal and should not be called directly.

connectedCallback() → {void}

This method is called by the dom and should not be called directly.

This method is called by the dom and should not be called directly.

Returns:
Type: 
void

disconnectedCallback() → {void}

This method is called by the dom and should not be called directly.

This method is called by the dom and should not be called directly.

Returns:
Type: 
void

getActiveTab() → {string|null}

A function that returns the name or id of the currently active tab.

A function that returns the name or id of the currently active tab.

The tabs have to be named with the data-monster-name attribute.

Returns:
Type: 
string | null

(static) getCSSStyleSheet() → {Array.<CSSStyleSheet>}

This method is called internal and should not be called directly.

This method is called internal and should not be called directly.

Returns:
Type: 
Array.<CSSStyleSheet>

(static) getTag() → {string}

This method is called internal and should not be called directly.

This method is called internal and should not be called directly.

Returns:
Type: 
string