Skip to main content
Version: 8.1

Perspective - Toggle Switch

Component Palette Icon:

Description​

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.

New in 8.1.2

The DateTime Picker 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
labelSettings for the label for the Toggle Switch.
  • text: Text for the Toggle Switch.

      New in 8.1.2
      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. Value is string.
  • position: Text position relative to the Toggle Switch: right or left. Value is 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
    colorColor settings for the Toggle Switch when it is selected and unselected.
  • selected: Color 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.
  • unselected: Color of the Toggle Switch when unselected (off). See Color Selector.
  • object
    enabledWhether 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
    styleSets 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​

    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