Button
When a button is clicked, it typically fires an action or triggers an event. The specific action or event that occurs depends on the code behind the button's onClick
. For example, a button might submit a form or save the data and progress its process.
Button Properties
The button is represented as a rounded rectangle. And has a text "label" overlay describing the action performed with the button click.
Property | Description |
---|---|
Lable | The text entered here will be displayed over the button. |
Disabled (Checkbox) | On selecting the checkbox, the GUI of the button "Greys Out" (i.e., the button becomes inactive and non-clickable). |
Visual Feedback (Checkbox) | Selecting the checkbox enables feedback on the button click. This gives a visual confirmation of the click. |
Visual Color (Only when "Visual Feedback" is checked) | Sets the color of the visual feedback. |
API Methods
setDisabled
Sets the Disabled flag for this component.
- Method
- Usage
setDisabled(readOnly: boolean): void
// Setting the Disabled to "true" renders the element as non-clickable
a8forms.Button("buttonId").setDisabled(true)
// Setting the Disabled to "false" enables the element to be clickable
a8forms.Button("buttonId").setDisabled(false)
setVisibility
Sets the Visibility flag for this component.
- Method
- Usage
setVisibility(visible: boolean): void
// Setting the visibility to "true" makes the element visible
a8forms.Button("buttonId").setVisibility(true)
// Setting the visibility to "false" makes the element invisible
a8forms.Button("buttonId").setVisibility(false)
setVisibilityCondition
Sets the visibility condition for this component.
- Method
- Usage
setVisibilityCondition(condition: string): void
// Sets a condition for changing the element's visibility status.
a8forms.Button("buttonId").setVisibilityCondition("1 === 1")
Event Handlers
Event handlers allow you to set triggers for various actions based on the fired events. They are as follows:
onClick
onClick
- Triggers an action, such as calling for a service or function when the button is clicked.