Skip to content

Toggle Switch

The Toggle Switch lets the operator turn a setting on or off. It is found in the Input - OpenBridge section of the Perspective Component Palette as Toggle Switch.

Toggle Switch that is on, with a label

The Toggle Switch is one of the input components. How values are written back, events, disabling and the behavior in the Designer are shared by all of them and are described in Input Components — Common Features. This page covers what is specific to the Toggle Switch.

A Toggle Switch with default properties and label set to Toggle Switch:

Toggle Switch with default properties and a label

A Toggle Switch dropped from the palette is off and has no label.

checked sets whether the switch is on:

Off (checked is false) On (checked is true)
Switch that is off Switch that is on

When the operator clicks the switch or its label, or presses Space while it has focus, the new state is written to checked and then onActionPerformed fires.

Bind checked bidirectionally to a tag to connect the switch to it. See Values.

Name Description Property Type
checked Whether the switch is on. Written when the operator clicks. Default false. value

label is the text to the left of the switch. A click on the label toggles the switch. Leave it empty for a switch without text:

Toggle Switch without a label

Name Description Property Type
label Text to the left of the switch. Empty by default. value

The Toggle Switch fills the width of its box: the label is at the left edge and the switch at the right edge. A label that does not fit on one line wraps. The blue frame is the component’s box:

160 px wide 320 px wide
Toggle Switch 160 px wide Toggle Switch 320 px wide

The Toggle Switch is always 56 px high, whatever the height of its box. A new component is 48 px high, so the switch extends 8 px below its box:

Toggle Switch in the box of a new component

Set the height to 56 px to make the box match what is drawn.


Off On
Disabled, off Disabled, on

See Disabled.


These work in the same way on every input component, and are described in Input Components — Common Features:

Event Description Event Object
onActionPerformed Fired when the operator toggles the switch, after checked is written. —

See Events.

  1. Drop a Toggle Switch into the view, make it 200 px wide and 56 px high, and set label to Auto start.
  2. Bind checked to the tag [default]Pump01/AutoStart and enable Bidirectional.

The switch now shows the tag value, and a click writes the new value to the tag.

Built on the OpenBridge Design System