toggle
Overview
toggle is an input component with a binary state, which allows users to easily switch between the two states.
Basic Example
<var name="agree" type="boolean" />
<toggle bind="agree" label="Toggle label"/>
Standard Attributes
bind
bindbindlabel
labellabelrequired
requiredrequiredAdvanced Attributes
align-content
align-contentalign-contentalign-label
align-labelalign-labeldisabled
disableddisabledid
ididlabel-case
label-caselabel-caselabel-color
label-colorlabel-colormode
modeOptional
Type: toggle | radio | checkbox
Default: toggle
Specify whether the boolean value should be displayed as a toggle, radio, or checkbox.
on-change
on-changeon-changeshow-if and hide-if
show-ifhide-ifshow-if and hide-ifstatus-disabled
status-disabledOptional
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
status-falseOptional
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.

status-true
status-trueOptional
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.

toggle-direction
toggle-directionOptional
Type: left-to-right | right-to-left
Default: left-to-right
Specify in which direction the toggle widget moves when activated.

toggle-position
toggle-positionOptional
Type: left | right
Default: left
Specify where the toggle button is positioned in the component (relative to the status text).

Component Methods
The following component methods are available when an id is assigned to the component and component.textInput({id:'my-id'}).xxx is called from JS/TS:
scrollIntoView
scrollIntoViewProgrammatically scroll until the toggle component is visible in the view.
setState
setStateProgrammatically set the state of the boolean bound to the toggle component.
toggleState
toggleStateProgrammatically toggle the state of the boolean bound to the toggle component. A false or null state will toggle to true, and a true state will toggle to false.
Last updated