Tabris.js Widgets: Switch

Switch widget is very similar to CheckBox. It provides the same functional, representing the HTML input type=checkbox tag alternative. Compared to CheckBox, Switch looks more modern and native, especially on the iOS platform. However, it lacks built-in label functionality, so you need to use separate TextView widget as a label. Position properties for the class are inherited from the Widget parent class.

Properties and events

  • Property checked determines switch state and stores it;
  • Properties thumbOnColor, thumbOnColor, trackOffColor, trackOnColor are used for customizing the switch colors. Using them, you can set a different color scheme depending on the switch state.

Example

For more detailed information about the widget, use Switch documentation page.