Skip to content
On this page

Class: UIText

WebSG.UIText

Class representing a text element within a user interface.

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new UIText()

Inherited from

UIElement.constructor

Properties

backgroundColor

Readonly backgroundColor: RGBA

Readonly RGBA object representing the background color of the UI element.

Inherited from

UIElement.backgroundColor

Defined in

websg.d.ts:1708


borderColor

Readonly borderColor: RGBA

Readonly RGBA object representing the border color of the UI element.

Inherited from

UIElement.borderColor

Defined in

websg.d.ts:1713


borderRadius

Readonly borderRadius: Vector4

Readonly Vector4 object representing the border radius of the UI element.

Inherited from

UIElement.borderRadius

Defined in

websg.d.ts:1733


borderWidth

Readonly borderWidth: Vector4

Readonly Vector4 object representing the border width of the UI element.

Inherited from

UIElement.borderWidth

Defined in

websg.d.ts:1728


color

Readonly color: RGBA

Readonly property representing the color of the text as an RGBA object.

Defined in

websg.d.ts:1837


margin

Readonly margin: Vector4

Readonly Vector4 object representing the margin of the UI element.

Inherited from

UIElement.margin

Defined in

websg.d.ts:1723


padding

Readonly padding: Vector4

Readonly Vector4 object representing the padding of the UI element.

Inherited from

UIElement.padding

Defined in

websg.d.ts:1718

Accessors

alignContent

get alignContent(): FlexAlign

Gets the align-content property of the UI element.

Returns

FlexAlign

Inherited from

UIElement.alignContent

Defined in

websg.d.ts:1510

set alignContent(value): void

Sets the align-content property of the UI element.

Parameters

NameTypeDescription
valueFlexAlignThe new align-content value for the UI element.

Returns

void

Inherited from

UIElement.alignContent

Defined in

websg.d.ts:1516


alignItems

get alignItems(): FlexAlign

Gets the align-items property of the UI element.

Returns

FlexAlign

Inherited from

UIElement.alignItems

Defined in

websg.d.ts:1521

set alignItems(value): void

Sets the align-items property of the UI element.

Parameters

NameTypeDescription
valueFlexAlignThe new align-items value for the UI element.

Returns

void

Inherited from

UIElement.alignItems

Defined in

websg.d.ts:1527


alignSelf

get alignSelf(): FlexAlign

Gets the align-self property of the UI element.

Returns

FlexAlign

Inherited from

UIElement.alignSelf

Defined in

websg.d.ts:1532

set alignSelf(value): void

Sets the align-self property of the UI element.

Parameters

NameTypeDescription
valueFlexAlignThe new align-self value for the UI element.

Returns

void

Inherited from

UIElement.alignSelf

Defined in

websg.d.ts:1538


bottom

get bottom(): number

Gets the bottom position of the UI element in pixels.

Returns

number

Inherited from

UIElement.bottom

Defined in

websg.d.ts:1488

set bottom(value): void

Sets the bottom position of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new bottom position value for the UI element in pixels.

Returns

void

Inherited from

UIElement.bottom

Defined in

websg.d.ts:1494


flexBasis

get flexBasis(): number

Gets the flex basis property of the UI element in pixels.

Returns

number

Inherited from

UIElement.flexBasis

Defined in

websg.d.ts:1565

set flexBasis(value): void

Sets the flex basis property of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new flex basis property value in pixels.

Returns

void

Inherited from

UIElement.flexBasis

Defined in

websg.d.ts:1571


flexDirection

get flexDirection(): FlexDirection

Gets the flex-direction property of the UI element.

Returns

FlexDirection

Inherited from

UIElement.flexDirection

Defined in

websg.d.ts:1543

set flexDirection(value): void

Sets the flex-direction property of the UI element.

Parameters

NameTypeDescription
valueFlexDirectionThe new flex-direction value for the UI element.

Returns

void

Inherited from

UIElement.flexDirection

Defined in

websg.d.ts:1549


flexGrow

get flexGrow(): number

Gets the flex grow property of the UI element.

Returns

number

Inherited from

UIElement.flexGrow

Defined in

websg.d.ts:1576

set flexGrow(value): void

Sets the flex grow property of the UI element.

Parameters

NameTypeDescription
valuenumberThe new flex grow property value.

Returns

void

Inherited from

UIElement.flexGrow

Defined in

websg.d.ts:1582


flexShrink

get flexShrink(): number

Gets the flex shrink property of the UI element.

Returns

number

Inherited from

UIElement.flexShrink

Defined in

websg.d.ts:1587

set flexShrink(value): void

Sets the flex shrink property of the UI element.

Parameters

NameTypeDescription
valuenumberThe new flex shrink property value.

Returns

void

Inherited from

UIElement.flexShrink

Defined in

websg.d.ts:1593


flexWrap

get flexWrap(): FlexWrap

Gets the flex wrap property of the UI element.

Returns

FlexWrap

Inherited from

UIElement.flexWrap

Defined in

websg.d.ts:1554

set flexWrap(value): void

Sets the flex wrap property of the UI element.

Parameters

NameTypeDescription
valueFlexWrapThe new flex wrap property value.

Returns

void

Inherited from

UIElement.flexWrap

Defined in

websg.d.ts:1560


fontFamily

get fontFamily(): string

Gets the font family used for the text.

Returns

string

Defined in

websg.d.ts:1793

set fontFamily(value): void

Sets the font family used for the text.

Parameters

NameTypeDescription
valuestringThe new font family. Accepts any valid CSS font-family value.

Returns

void

Defined in

websg.d.ts:1799


fontSize

get fontSize(): number

Gets the font size of the text in pixels.

Returns

number

Defined in

websg.d.ts:1815

set fontSize(value): void

Sets the font size of the text in pixels.

Parameters

NameTypeDescription
valuenumberThe new font size. Accepts any valid CSS font-size value.

Returns

void

Defined in

websg.d.ts:1821


fontStyle

get fontStyle(): string

Gets the font style used for the text.

Returns

string

Defined in

websg.d.ts:1826

set fontStyle(value): void

Sets the font style used for the text.

Parameters

NameTypeDescription
valuestringThe new font style. Accepts any valid CSS font-style value.

Returns

void

Defined in

websg.d.ts:1832


fontWeight

get fontWeight(): string

Gets the font weight used for the text.

Returns

string

Defined in

websg.d.ts:1804

set fontWeight(value): void

Sets the font weight used for the text.

Parameters

NameTypeDescription
valuestringThe new font weight. Accepts any valid CSS font-weight value.

Returns

void

Defined in

websg.d.ts:1810


height

get height(): number

Gets the height of the UI element in pixels.

Returns

number

Inherited from

UIElement.height

Defined in

websg.d.ts:1620

set height(value): void

Sets the height of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new height of the UI element in pixels.

Returns

void

Inherited from

UIElement.height

Defined in

websg.d.ts:1626


justifyContent

get justifyContent(): FlexJustify

Gets the justify content property of the UI element.

Returns

FlexJustify

Inherited from

UIElement.justifyContent

Defined in

websg.d.ts:1598

set justifyContent(value): void

Sets the justify content property of the UI element.

Parameters

NameTypeDescription
valueFlexJustifyThe new justify content property value.

Returns

void

Inherited from

UIElement.justifyContent

Defined in

websg.d.ts:1604


left

get left(): number

Gets the left position of the UI element in pixels.

Returns

number

Inherited from

UIElement.left

Defined in

websg.d.ts:1499

set left(value): void

Sets the left position of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new left position value for the UI element in pixels.

Returns

void

Inherited from

UIElement.left

Defined in

websg.d.ts:1505


maxHeight

get maxHeight(): number

Gets the maximum height of the UI element in pixels.

Returns

number

Inherited from

UIElement.maxHeight

Defined in

websg.d.ts:1664

set maxHeight(value): void

Sets the maximum height of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new maximum height of the UI element.

Returns

void

Inherited from

UIElement.maxHeight

Defined in

websg.d.ts:1670


maxWidth

get maxWidth(): number

Gets the maximum width of the UI element.

Returns

number

Inherited from

UIElement.maxWidth

Defined in

websg.d.ts:1653

set maxWidth(value): void

Sets the maximum width of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new maximum width of the UI element in pixels.

Returns

void

Inherited from

UIElement.maxWidth

Defined in

websg.d.ts:1659


minHeight

get minHeight(): number

Gets the minimum height of the UI element in pixels.

Returns

number

Inherited from

UIElement.minHeight

Defined in

websg.d.ts:1642

set minHeight(value): void

Sets the minimum height of the UI element.

Parameters

NameTypeDescription
valuenumberThe new minimum height of the UI element.

Returns

void

Inherited from

UIElement.minHeight

Defined in

websg.d.ts:1648


minWidth

get minWidth(): number

Gets the minimum width of the UI element in pixels.

Returns

number

Inherited from

UIElement.minWidth

Defined in

websg.d.ts:1631

set minWidth(value): void

Sets the minimum width of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new minimum width of the UI element in pixels.

Returns

void

Inherited from

UIElement.minWidth

Defined in

websg.d.ts:1637


parent

get parent(): undefined | UIElement

Gets the parent UI element of the current element or undefined if the element has no parent.

Returns

undefined | UIElement

Inherited from

UIElement.parent

Defined in

websg.d.ts:1698


position

get position(): ElementPositionType

Gets the position of the UI element.

Returns

ElementPositionType

Inherited from

UIElement.position

Defined in

websg.d.ts:1455

set position(value): void

Sets the position of the UI element.

Parameters

NameTypeDescription
valueElementPositionTypeThe new position type for the UI element.

Returns

void

Inherited from

UIElement.position

Defined in

websg.d.ts:1461


get right(): number

Gets the right position of the UI element in pixels.

Returns

number

Inherited from

UIElement.right

Defined in

websg.d.ts:1477

set right(value): void

Sets the right position of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new right position value for the UI element in pixels.

Returns

void

Inherited from

UIElement.right

Defined in

websg.d.ts:1483


top

get top(): number

Gets the top position of the UI element in pixels.

Returns

number

Inherited from

UIElement.top

Defined in

websg.d.ts:1466

set top(value): void

Sets the top position of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new top position value for the UI element in pixels.

Returns

void

Inherited from

UIElement.top

Defined in

websg.d.ts:1472


type

get type(): ElementType

Gets the type of the UI element.

Returns

ElementType

Inherited from

UIElement.type

Defined in

websg.d.ts:1703


value

get value(): string

Gets the text content of the UIText element.

Returns

string

Defined in

websg.d.ts:1782

set value(value): void

Sets the text content of the UIText element.

Parameters

NameTypeDescription
valuestringThe new text content.

Returns

void

Defined in

websg.d.ts:1788


width

get width(): number

Gets the width of the UI element in pixels.

Returns

number

Inherited from

UIElement.width

Defined in

websg.d.ts:1609

set width(value): void

Sets the width of the UI element in pixels.

Parameters

NameTypeDescription
valuenumberThe new width of the UI element in pixels.

Returns

void

Inherited from

UIElement.width

Defined in

websg.d.ts:1615

Methods

addChild

addChild(element): UIText

Adds a child UI element to the current element.

Parameters

NameTypeDescription
elementUIElementThe child UI element to add.

Returns

UIText

Inherited from

UIElement.addChild

Defined in

websg.d.ts:1676


children

children(): UIElementIterator

Returns an iterator for the children of the current UI element.

Returns

UIElementIterator

Inherited from

UIElement.children

Defined in

websg.d.ts:1693


getChild

getChild(index): undefined | UIElement

Gets the child UI element at the specified index or undefined if the index is out of bounds.

Parameters

NameTypeDescription
indexnumberThe index of the child UI element.

Returns

undefined | UIElement

Inherited from

UIElement.getChild

Defined in

websg.d.ts:1688


removeChild

removeChild(element): UIText

Removes a child UI element from the current element.

Parameters

NameTypeDescription
elementUIElementThe child UI element to remove.

Returns

UIText

Inherited from

UIElement.removeChild

Defined in

websg.d.ts:1682