Content:
- Examples
- Properties
- Methods

A Switch in mobile UI design is a toggle control that allows users to turn a setting on or off.

swt = ui.addSwitch( parent, text, options?, width?, height? ) → ui object: Switch

Here are the available methods of the Switch Component.

Examples

Example - Basic click to expand contents 

Example - Right switch with custom styles click to expand contents 

Properties

The following properties are available on the Switch object:

absHeightNumber
absLeftNumber
absTopNumber
absWidthNumber
backColorString
backImageString
borderNumber
borderColorString
borderStyleString
colorString
cornerRadiusNumber
disabledBoolean
disableRippleBoolean
edgeString
elObject
elStyleString
enableBoolean
fontFileString
heightNumber
iconPositionString
isVisibleBoolean
leftNumber
marginsList
opacityNumber
optionsString
paddingList
parentObject
positionObject
requiredBoolean
rotationNumber
sizeVariantString
spaceBetweenNumber
textString
textColorString
textSizeNumber
topNumber
typeString
valueBoolean
visibilityString
widthNumber

Methods

The following methods are available on the Switch object:

getPosition( options ) → Object
gone()
hide()
setScale( x, y )
show()