Skip to content

ToggleSwitchView

The ToggleSwitchView control is used to display the 'switch' control with different on/off texts.
The ToggleSwitchView inherits all the methods and properties from the base class View.

Constructor:

  • constructor(parent: View)
    Creates an instance of ToggleSwitchView control.
    • parent: the View containing the control itself.

Properties:

  • on: boolean
    Indicates toggle-button is 'ON'.
  • onText: string
    Text displayed next to the 'knob' when it's 'ON'.
  • offText: string
    Text displayed next to the 'knob' when it's 'OFF'.
  • readOnly: boolean
    Indicates whether the control is in read-only mode. Default is false.
  • thumbColor: string
    The color of the knob when toggle-button is 'ON'.

Methods:

  • change(handler: ()=> any)
    Registers an event handler that is triggered after toggle-button knob is toggled.