Component Palette Icon:

On this page ...


The Toggle Switch represents a bit: on (selected) or off (not selected). By default, when the switch is selected the color is blue. It is gray when it is not selected. Logically, this component is very similar to the Checkbox component.

The following feature is new in Ignition version 8.1.2
Click here to check out the other new features

The Toggle Switch component has three pre-configured variants:

  • No Text - Default layout with no text.
  • Text Right - Layout with text on the right of the Toggle Switch.
  • Text Left - Layout with text on the left of the Toggle Switch.


Properties

Most Properties have binding options. For more information on Bindings, see Types of Bindings in Perspective.
This section only documents the Props Category of properties. The other Categories are described on the Perspective Component Properties page.

NameDescriptionProperty Type
selectedThe selected state of the Toggle Switch.value: boolean
label

Settings for the label for the Toggle Switch.

NameDescriptionProperty Type
text

Text for the Toggle Switch.


The following feature is new in Ignition version 8.1.26
Click here to check out the other new features
Text can also be entered directly by deep selecting the Toggle Switch component, which enables inline editing. Changes are immediately reflected in the text property field. 

string
positionText position relative to the Toggle Switch: right or left.value: boolean
style

Modify text style using the style properties. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class

object
object
color

Color settings for the Toggle Switch when it is selected and unselected.

NameDescriptionProperty Type
selectedColor of the Toggle Switch when selected (on). Can be chosen from color wheel, chosen from color palette, or entered as RGB or HSL value. See Color Selector.color
unselectedColor of the Toggle Switch when unselected (off). See Color Selector.color
object
enabled

Whether the user should be allowed to alter the Toggle Switch's selected state. Default is true.

Note: If the component is disabled, scripts can still run on the component. For example, if you add a script action to the onClick event, the script will fire when the user clicks on the Toggle Switch.

value: boolean
style

Sets a style for this component. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class

object


Component Events

Perspective Component Events
The Perspective Event Types Reference page describes all the possible component event types for Perspective components. Not all component events support each Perspective component. The Component Events and Actions page shows how to configure events and actions on a Perspective component. Component scripting is handled separately and can be accessed from the Component menubar or by right clicking on the component.


Example

Image above shows both selected and deselected positions for the following properties.

PropertyValue
props.label.textOff / On
props.label.positionleft
props.color.selected#FF0000
props.color.unselected#8AFF8A


  • No labels