/ui/elements/control

Module to export a method to decorate a control element with tabs and a panel.

Methods

(inner) addControl This function allows for adding more controls to the control element. This is done by calling add on the conttol element. ```javascript contolElement.add({ key: 'layers', panel: layersPanel }) ```(params)

Parameters:
NameTypeDescription
paramsObject

configuration options for the new control.

Properties
NameTypeAttributesDescription
params.keyString

Identifier used as the data-id of the element.

params.minWidthInteger<optional>

Optional minimum width of the element.

params.iconString<optional>

The name of a Material symbols icon.

params.classListString<optional>

Class definitions for the element.

params.onClickfunction<optional>

A function to call when the tab is clicked.

params.titleString<optional>

The title of the element i.e hover text.

params.panelHTMLElement<optional>

The panel associated to the tab.

(inner) control(params) → {Object}

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.targetHTMLElement

The target for the control element.

Returns:

The ctrlTarget with the tab and panel appended.

Type: 
Object

(inner) onClick The defualt onClick behaviour for the tabs.(e, params)

Parameters:
NameTypeDescription
eEvent

The event from the click.

paramsObject

Configurtation options for the tab.

Properties
NameTypeAttributesDescription
params.parentHTMLElement

The parent element of the tab.

params.tabHTMLElement

The tab itself.

params.panelHTMLElement

The panel associated ot the tab.

params.focusString | HTMLElement<optional>

The name attribute of the element to focus when the tab is clicked.