Skip to content

UI Label

Updated

A text label.

Type
comp-ui-label
Script class
UILabelComponent
Per entity
One
Version
1.3.0

Read about it in Content: what it does, how to use it from a script, and examples.

The props the runtime declares for this component, with their defaults and accepted ranges.

Prop Default Range
borderRadius
borderRadius[] 0 ≤ x ≤ 16384
borderWidth
borderWidth[] 0 ≤ x ≤ 16384
fontSize 0 ≤ x ≤ 4096
fontWeight 1 ≤ x ≤ 1000
letterSpacing -16384 ≤ x ≤ 16384
lineHeight 0 ≤ x ≤ 10
margin
margin[] -16384 ≤ x ≤ 16384
maxHeight 0 ≤ x ≤ 16384
maxWidth 0 ≤ x ≤ 16384
minHeight 0 ≤ x ≤ 16384
opacity 0 ≤ x ≤ 1
padding
padding[] 0 ≤ x ≤ 16384
width 0 ≤ x ≤ 16384

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • UILabel::press

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(UILabelComponent);
if (component) log(component.props);
}