ButtonElement
class ButtonElement implements ElementContract
Properties
| protected PlainTextOnlyTextObject | $text | A text object that defines the button's text. |
|
| protected string|null | $actionId | An identifier for this action. |
|
| protected string|null | $url | A URL to load in the user's browser when the button is clicked. |
|
| protected string|null | $value | The value to send along with the interaction payload. |
|
| protected string|null | $style | Decorates buttons with alternative visual color schemes. Use this option with restraint. |
|
| protected ConfirmObject|null | $confirm | A confirm object that defines an optional confirmation dialog after the button is clicked. |
|
| protected string|null | $accessibilityLabel | A label for longer descriptive text about a button element. |
Methods
Set the URL for the button.
Set the action ID for the button.
Set the value for the button.
Set the style for the button to primary.
Set the style for the button to danger.
Set the accessibility label for the button.
Get the instance as an array.
Details
at line 84
__construct(string $text, Closure|null $callback = null)
Create a new button element instance.
at line 98
ButtonElement
url(string $url)
Set the URL for the button.
at line 112
ButtonElement
id(string $id)
Set the action ID for the button.
at line 126
ButtonElement
value(string $value)
Set the value for the button.
at line 140
ButtonElement
primary()
Set the style for the button to primary.
at line 150
ButtonElement
danger()
Set the style for the button to danger.
at line 160
ConfirmObject
confirm(string $text, Closure|null $callback = null)
Set the confirm object for the button.
at line 174
ButtonElement
accessibilityLabel(string $label)
Set the accessibility label for the button.
at line 188
array
toArray()
Get the instance as an array.