Links

toggle

Overview

toggle is an input component with a binary state, which allows users to easily switch between the two states.
Version compatibility
toggle was introduced in version 4.36.1 of the JourneyApps Container.

Basic Example

main.view.xml
<var name="agree" type="boolean" />
<toggle bind="agree" label="Toggle label"/>

Standard Attributes

bind

label

required

Advanced Attributes

align-content

align-label

disabled

label-case

Version compatibility
label-case was introduced in version 4.80.0 of the JourneyApps Runtime.

label-color

mode

Optional
Type: toggle | radio | checkbox
Default: toggle
Version compatibility
mode was introduced in version 4.84.0 of the JourneyApps Runtime.
Specify whether the boolean value should be displayed as a toggle, radio, or checkbox.

modifier-text

on-change

show-if and hide-if

status-disabled

Optional
Type: string (static text, a format string or the return value of a JS/TS function)
Default: unset
Text displayed to the right of the toggle when it is disabled.

status-false

Optional
Type: string (static text, a format string or the return value of a JS/TS function)
Default: unset
Text displayed to the right of the toggle when it is bound to a false state.
main.view.xml
<var name="toggle_state" type="boolean"/>
<toggle bind="toggle_state" label="Toggle label" status-true="On" status-false="Off"/>

status-true

Optional
Type: string (static text, a format string or the return value of a JS/TS function)
Default: unset
Text displayed to the right of the toggle when it is bound to a true state.
main.view.xml
<var name="toggle_state" type="boolean"/>
<toggle bind="toggle_state" label="Toggle label" status-true="On" status-false="Off"/>

toggle-direction

Version compatibility
toggle-direction was introduced in version 4.86.1 of the JourneyApps Runtime.
Optional
Type: left-to-right | right-to-left
Default: left-to-right
Specify in which direction the toggle widget moves when activated.
main.view.xml
<columns>
<column>
<info>toggle-direction="left-to-right"</info>
<toggle toggle-direction="left-to-right" bind="i_agree" label="Agree?" status-true="Yes" status-false="No" />
</column>
<column>
<info>toggle-direction="right-to-left"</info>
<toggle toggle-direction="right-to-left" bind="i_agree" label="Agree?" status-true="Yes" status-false="No" />
</column>
</columns>

toggle-position

Version compatibility
toggle-position was introduced in version 4.86.1 of the JourneyApps Runtime.
Optional
Type: left | right
Default: left
Specify where the toggle button is positioned in the component (relative to the status text).
main.view.xml
<columns>
<column>
<info>toggle-position="left"</info>
<toggle toggle-position="left" bind="i_agree" label="Agree?" status-true="Yes" status-false="No" />
</column>
<column>
<info>toggle-position="right"</info>
<toggle toggle-position="right" bind="i_agree" label="Agree?" status-true="Yes" status-false="No" />
</column>
</columns>
Last modified 1mo ago