Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / UITextComponent

Class: UITextComponent ​

Defined in: components/UIText.ts:35

A block of text drawn onto a transparent canvas quad.

Pure text — put a UIPanelComponent entity behind it for a card look. fontSize is in METRES (how tall the glyphs stand in the world), so text reads the same regardless of texture density. Wrapping is automatic inside width; overflow past height is line-clamped with an ellipsis.

Extends ​

Constructors ​

Constructor ​

ts
new UITextComponent(options?): UITextComponent;

Defined in: components/UIText.ts:67

Parameters ​

ParameterType
options?UITextOptions

Returns ​

UITextComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDescriptionDefined in
textstring-components/UIText.ts:36
widthnumberLayout box width in metres — wrap happens against this.components/UIText.ts:38
heightnumberLayout box height in metres — overflow clamps to it.components/UIText.ts:40
fontSizenumberGlyph height in metres.components/UIText.ts:42
fontWeightnumberCSS font weight (400 normal, 600 semibold…).components/UIText.ts:44
colorstring-components/UIText.ts:45
alignUiTextAlign-components/UIText.ts:46
valignUiTextVAlign-components/UIText.ts:47
lineHeightnumberUnitless multiplier over fontSize.components/UIText.ts:49
paddingnumberInner padding in metres.components/UIText.ts:51
pixelDensity?numberTexture density in px/metre, clamped 256–2048 at render time. Absent means the default: a defaulted field would count as a change on every instance of a prefab saved before it existed.components/UIText.ts:57
style?UiStyleModern styling; wins over the flat fields above. Absent until authored.components/UIText.ts:59
variant?| "body" | "caption" | "label" | "title" | "display" | "heading" | "value" | "badge"Its role under a themed panel, which sets face, weight and colour: display, title, heading, body (the default), caption, label, value (a big number) or badge (a small pill). Size stays fontSize.components/UIText.ts:65