Skip to main content

Toggle Button


A toggle button can be considered a visual representation of the boolean function. And like any other button, it enables the users to initiate an action. The toggle allows you to set true/false (on/off) triggers for the given action, enabling the users to change the settings between two states.

API Methods

setDisabled

Sets the Disabled flag for this component.

setDisabled(readOnly: boolean): void

setVisibility

Sets the Visibility flag for this component.

setVisibility(visible: boolean): void

setVisibilityCondition

Sets the visibility condition for this component.

setVisibilityCondition(condition: string): void

Event Handlers

Event handlers allow you to set triggers for various actions based on the fired events. They are as follows:

onToggle

onToggle - Sets an action to be fired with the toggle button is selected.

Example:

To show/hide a button based on the toggle status - when the user selects the "I Accept" toggle, the status is set to true, and the button gets enabled.

Toggle Toggle

onToggle
if (isToggled) {
a8forms.Toggle("buttonId").setVisibility(true)
}
else {
a8forms.Toggle("buttonId").setVisibility(false)
}

// Where "buttonId" is the ID of the component (button in this case) that you are setting to show/hide based on the toggle state.