-
Notifications
You must be signed in to change notification settings - Fork 7
EditBox
Refaltor77 edited this page Mar 29, 2026
·
1 revision
Text input field element.
use refaltor\ui\elements\EditBox;
$input = EditBox::create("my_input");$input->setTextBoxName("username_field"); // Identifier
$input->setPlaceHolderText("Enter name..."); // Placeholder text
$input->setMaxLength(32); // Max characters
$input->setEnabled(true); // Editable
$input->setTextBoxVisible(true); // Visible
$input->setVirtual(false); // Virtual keyboardControls which characters are allowed:
$input->setTextType(EditBox::TEXT_TYPE_EXTENDED_ASCII); // All characters
$input->setTextType(EditBox::TEXT_TYPE_IDENTIFIER_CHARS); // Letters, numbers, _
$input->setTextType(EditBox::TEXT_TYPE_NUMBER_CHARS); // Numbers only$input->setTextColor([1.0, 1.0, 1.0]); // Active text color
$input->setLockedColor([0.5, 0.5, 0.5]); // Locked/disabled color
$input->setPlaceHolderTextColor("placeholder"); // Placeholder color$input->setTextEditBoxGridCollectionName("inputs"); // For grids
$input->setConstrainedTextEditBox("constrained"); // Constraint// Username field
$username = EditBox::create("username_input")
->setTextBoxName("username")
->setPlaceHolderText("Enter your username...")
->setMaxLength(32)
->setTextType(EditBox::TEXT_TYPE_EXTENDED_ASCII)
->setTextColor(BasicColor::white())
->setSize(280, 25);
// Number-only field (world seed)
$seed = EditBox::create("seed_input")
->setTextBoxName("seed")
->setPlaceHolderText("Enter seed...")
->setMaxLength(20)
->setTextType(EditBox::TEXT_TYPE_NUMBER_CHARS)
->setTextColor(BasicColor::cyan())
->setSize(280, 25);
// Disabled field
$locked = EditBox::create("locked_input")
->setTextBoxName("locked")
->setPlaceHolderText("Read only")
->setEnabled(false)
->setLockedColor(BasicColor::rgb(0.4, 0.4, 0.4))
->setSize(280, 25);