Skip to content
Elysio Martins edited this page Nov 4, 2023 · 2 revisions

button

What is a Button?

A button is a UI element that allows users to trigger an action or event when clicked. It often features customizable text and appearance.

How to Create a Button on My Root Builder? 🔥

  1. Instantiate the button:
$button = Button::create("button_one", $root);

Very important phase of the button to activate button system !

$panel = Panel::create("button_panel");

# very very VERY important to activate mapping of yours multiple buttons !
$panel->enableFactoryButton($root);


$button = Button::create("button_one", $root);

# title of your button in scripting API or pocketmine or other software tools ...
$button->setVisibleIfTitle("BUTTON_TITLE_TEST");



// others properties ...
  1. Add the image to my root:
# Add the element to the root instance
$root->addElement($image);
Clone this wiki locally