UI Input
Updated
Single-line text field.
- Type
comp-ui-input- Script class
UIInputComponent- Per entity
- One
- Version
- 1.3.0
Read about it in Controls: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
flexGrow |
0 ≤ x ≤ 1000 |
|
margin |
||
margin[] |
- |
|
maxLength |
0 ≤ x ≤ 65536, integer |
|
maxRows |
1 ≤ x ≤ 256, integer |
|
padding |
||
padding[] |
0 ≤ x ≤ 16384 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
UIInput::changeUIInput::submitUIInput::focusUIInput::blur
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A name fieldA UI Input that greets the player as they type and confirms the name on Enter: a Behavior script listens to the field's change and submit events.
Click the field and type a name: the greeting follows each key. Press Enter to confirm it in green. Drag outside the panel to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(UIInputComponent); if (component) log(component.props);}