Monster.Components.Form. ToggleSwitch

This CustomControl creates a ToggleSwitch element

Constructor

new ToggleSwitch()

A simple Switch

Since
  • 3.57.0

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
valuestringcurrent

value of the element

disabledBooleandisabled=false

Disabled state

classesObject
Properties
NameTypeDefaultDescription
onstringspecifies

the class for the on state.

offstringspecifies

the class for the off state.

valuesObject
Properties
NameTypeDefaultDescription
offstringspecifies

the value of the element if it is not selected

labelsObject
Properties
NameTypeDefaultDescription
onstringspecifies

the label for the on state.

offstringspecifies

the label for the off state.

templatesObject
Properties
NameTypeDefaultDescription
mainstringspecifies

the main template used by the control.

Since
  • 3.57.0
See

state

returns the status of the element

e = document.querySelector('monster-toggle-switch');
console.log(e.state)
// ↦ off
.

returns the status of the element

e = document.querySelector('monster-toggle-switch');
console.log(e.state)
// ↦ off

value

The current value of the Switch

e = document.querySelector('monster-toggle-switch');
console.log(e.value)
// ↦ on
.

The current value of the Switch

e = document.querySelector('monster-toggle-switch');
console.log(e.value)
// ↦ on

value

Set value

e = document.querySelector('monster-toggle-switch');
e.value="on"
.

Set value

e = document.querySelector('monster-toggle-switch');
e.value="on"
Properties
NameTypeDescription
valuestring

(static) instanceSymbol

This method is called by the instanceof operator.

This method is called by the instanceof operator.

Since
  • 2.1.0

Methods

assembleMethodSymbol() → {Monster.Components.Form.ToggleSwitch}

click()

toggle switch

e = document.querySelector('monster-toggle-switch');
e.click()
.

toggle switch

e = document.querySelector('monster-toggle-switch');
e.click()

toggle() → {ToggleSwitch}

toggle switch on/off

e = document.querySelector('monster-toggle-switch');
e.toggle()
.

toggle switch on/off

e = document.querySelector('monster-toggle-switch');
e.toggle()
Returns:
Type: 
ToggleSwitch

toggleOff() → {ToggleSwitch}

toggle switch off

e = document.querySelector('monster-toggle-switch');
e.toggleOff()
.

toggle switch off

e = document.querySelector('monster-toggle-switch');
e.toggleOff()
Returns:
Type: 
ToggleSwitch

toggleOn() → {ToggleSwitch}

toggle switch on

e = document.querySelector('monster-toggle-switch');
e.toggleOn()
.

toggle switch on

e = document.querySelector('monster-toggle-switch');
e.toggleOn()
Returns:
Type: 
ToggleSwitch

updaterTransformerMethodsSymbol() → {function}

updater transformer methods for pipe

.

updater transformer methods for pipe

Returns:
Type: 
function

(static) getCSSStyleSheet()

Returns:

[CSSStyleSheet]