Skip to content
Refaltor77 edited this page Mar 29, 2026 · 1 revision

Root

Top-level container for a UI screen. Manages namespace, elements, and animations.

Creation

use refaltor\ui\builders\Root;

$root = Root::create("my_namespace");
// or
$root = Root::create(); // namespace set later via RootBuild

Methods

Elements

$root->addElement($element);          // Add single element
$root->addElements([$el1, $el2]);     // Add multiple

Animations

$root->addAnimation($animation);       // Add single animation
$root->addAnimations([$a1, $a2]);     // Add multiple

Configuration

$root->setNamespace("my_namespace");   // Set namespace
$root->setTitleCondition("MY_TITLE");  // Visibility condition

Generation

$root->generateAndSaveJson("ui/my_screen.json"); // Save to file

JSON Output

The Root serializes to:

{
    "namespace": "my_namespace",
    "@my_animation": { "anim_type": "alpha", ... },
    "my_element": { "type": "label", ... }
}

See Also

  • RootBuild — Interface for screen definitions
  • Animation — Declaring animations on Root
  • Element — Elements added to Root

Clone this wiki locally