Skip to main content

<pc-element>

The <pc-element> tag is used to define an element component.

Usage

Attributes

AttributeTypeDefaultDescription
anchorVector4"0 0 0 1"Sets the element's anchor as left bottom right top relative to its parent. Each value ranges from 0 to 1. [0,0,0,0] anchors to the bottom-left; [1,1,1,1] anchors to the top-right. If left≠right or bottom≠top (a split anchor), the element resizes to cover that area, e.g. [0,0,1,1] fills the parent.
assetString-Font asset ID (must reference a font type asset)
auto-widthFlag-Whether to automatically adjust width to fit content
colorColor"1 1 1 1"Color as space-separated RGBA values, hex code, or named color
enabledBoolean"true"Enabled state of the component
font-sizeNumber"16"Font size in pixels
line-heightNumber"1.2"Line height multiplier
pivotVector2"0.5 0.5"Pivot point as "X Y" values
textString-Text content to display
typeEnum"group"Element type: "group" | "image" | "text"
widthNumber"0"Width in pixels (0 for auto-sizing)
wrap-linesFlag-Whether to wrap text lines

Example

<pc-entity>
<pc-element type="text" asset="arial" text="Hello, World!"></pc-element>
</pc-entity>

JavaScript Interface

You can programmatically create and manipulate <pc-element> elements using the ElementComponentElement API.