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.
Name | Type | Description |
---|---|---|
elementId | string | A unique identifier for the button element |
action | APIAction | URLNavigationAction | CustomAction | The action to be performed when the button is clicked |
buttonText | string | The text to be displayed on the button. This value is an empty string by default |
ButtonElement
class:
ButtonElement
is created with an elementId “1”, an APIAction
as an action, and “Submit” as the button text.
setDisableAfterInteracted()
method allows changing this property. It accepts a boolean value indicating whether the button should be disabled after it is interacted with.
ButtonElement
:
ButtonElement
is created. The button text, action and interaction property are retrieved, updated, and logged. Then a new ButtonElement
instance is made from a JSON object and its button text is retrieved and logged.