Skip to main content
Version: 1.0.4

Switch

An on/off toggle exposing a boolean. Bound to a writable boolean tag it is the most direct control on a screen.

The Switch component as it renders with its default settings.The Switch component as it renders with its default settings.

Reach for it when you need:

  • Enable/disable a function
  • A boolean field inside a Form

Component name: Switch · Category: Input

In the palette: On/off toggle (exposes a boolean value)

Properties

Any property can be bound to a tag, another component's property, or a query.

PropertyTypeDefaultDescription
valuebooleanfalseThe toggle state — reflects what the user sets, and bindable.
titlestringSwitch
showTitlebooleantrue
titleSizenumber13
titlePositionenumtopWhere the title sits relative to the switch: above (top), or inline to its left / right. Options: top · left · right.
disabledbooleanfalse
stylestyle{}Custom CSS properties

Events

Attach event actions to these in the Event Manager.

EventLabelGroupPayload
clickClickMouseThe DOM event.
dblclickDouble clickMouseThe DOM event.
contextmenuRight clickMouseThe DOM event.
mouseenterMouse enterMouseThe DOM event.
mouseleaveMouse leaveMouseThe DOM event.
changeChangeInputThe DOM event.
submitSubmitInputThe DOM event.
focusFocusInputThe DOM event.
blurBlurInputThe DOM event.
Right-click behaves differently in the Designer

contextmenu fires your configured actions at runtime only — in LiveView and in preview. On the Designer canvas the right-click is captured to open the Event Manager, so testing it there will not run your actions. Test right-click in preview.

Notes

A switch bound straight to a plant tag writes on every flick. For anything consequential, bind it to a client variable and write through a confirmed script action instead.