Skip to main content
Version: v4

Button Element

The ButtonElement class, inherited from the BaseInteractiveElement class, represents an interactive button element that can be added to a chat interface. It comprises of properties like button text and a flag indicating whether the button should be disabled after interaction.

Parameters

Button Properties

NameTypeDescription
elementIdstringA unique identifier for the button element
buttonTextStringThe text to be displayed on the button.
actionActionEntityThe action to be performed when the button is clicked
descriptionStringString description of the button
disableAfterInteractedboolUsed to set if the button should be enabled or disabled after interaction

Class Usage

How to create an instance of the ButtonElement class:

let action = URLNavigationAction()
action.url = "https://www.cometchat.com/"

let buttonElement = ButtonElement()
buttonElement.elementId = "id"
buttonElement.buttonText = "About Us"
buttonElement.action = action

In this example, a new instance of ButtonElement is created with an elementId "id", an URLNavigationAction as an action, and "About Us" as the button text.