Monster.Components.Form. StateButton

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

Dependencies: the system uses functions of the monsterjs library

You can create this control either by specifying the HTML tagdirectly in the HTML or using Javascript via thedocument.createElement('monster-state-button');` method.

<monster-state-button></monster-state-button>

Or you can create this CustomControl directly in Javascript:

import {StateButton} from 'https://cdn.jsdelivr.net/npm/@schukai/[email protected]/dist/modules/state-button.js';
document.createElement('monster-state-button');

Constructor

new StateButton()

A state button with icons

Since
  • 1.5.0

Members

defaults

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

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

To set the options via the html tag the attribute data-monster-options must be set. As value a JSON object with the desired values must be defined.

The JSON can be specified as a DataURI.

new Monster.Types.DataUrl(btoa(JSON.stringify({
       shadowMode: 'open',
       delegatesFocus: true,
       templates: {
           main: undefined
       }
   })),'application/json',true).toString()

The attribute data-monster-options-selector can be used to access a script tag that contains additional configuration.

As value a selector must be specified, which belongs to a script tag and contains the configuration as json.

<script id="id-for-this-config" type="application/json">
   {
       "config-key": "config-value"
   }
</script>

The individual configuration values can be found in the table.

Properties
NameTypeDescription
templatesObject

Template definitions

Properties
NameTypeDescription
mainstring

Main template

statesObject

Available status

Properties
NameTypeDescription
successful=Monster.Components.Form.Types.State

successful

activity=Monster.Components.Form.Types.State

activity

failed=Monster.Components.Form.Types.State

failed

currentMonster.Components.Form.Types.State

current status

actions.clickMonster.Components.Form~exampleActionCallback

Methods

(static) getCSSStyleSheet() → {CSSStyleSheet}

Returns:
Type: 
CSSStyleSheet

(static) getTag() → {string}

Returns:
Type: 
string

getState(state) → {Monster.Components.Form.Types.State|undefined}

Parameters:
NameTypeDescription
stateString
Returns:
Type: 
Monster.Components.Form.Types.State | undefined

removeState() → {Monster.Components.Form.StateButton}

setState(state) → {Monster.Components.Form.StateButton}

Parameters:
NameTypeDescription
statestate
Throws:
  • value is not a string

    Type
    TypeError
  • value is not an instance

    Type
    TypeError