ButtonElement
class ButtonElement implements ElementContract
Traits
Properties
| protected PlainTextOnlyTextObject | $text | A text object that defines the button's text. |
|
| protected string | $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 86
__construct(string $text, Closure|null $callback = null)
Create a new button element instance.
at line 100
ButtonElement
url(string $url)
Set the URL for the button.
at line 114
ButtonElement
id(string $id)
Set the action ID for the button.
at line 128
ButtonElement
value(string $value)
Set the value for the button.
at line 142
ButtonElement
primary()
Set the style for the button to primary.
at line 152
ButtonElement
danger()
Set the style for the button to danger.
at line 162
ConfirmObject
confirm(string $text, Closure|null $callback = null)
Set the confirm object for the button.
at line 176
ButtonElement
accessibilityLabel(string $label)
Set the accessibility label for the button.
at line 190
array
toArray()
Get the instance as an array.