ElementComponent: {
    alignment: number[];
    anchor: number[];
    autoFitHeight: boolean;
    autoFitWidth: boolean;
    autoHeight: boolean;
    autoWidth: boolean;
    batchGroupId: number;
    color: number[];
    enabled: boolean;
    enableMarkup: boolean;
    fontAsset: number;
    fontSize: number;
    height: number;
    key: string;
    layers: number[];
    lineHeight: number;
    margin: number[];
    mask: boolean;
    materialAsset: number;
    maxFontSize: number;
    maxLines: number;
    minFontSize: number;
    opacity: number;
    outlineColor: number[];
    outlineThickness: number;
    pivot: number[];
    pixelsPerUnit: number;
    rect: number[];
    shadowColor: number[];
    shadowOffset: number[];
    spacing: number;
    spriteAsset: number;
    spriteFrame: number;
    text: string;
    textureAsset: number;
    type: string;
    useInput: boolean;
    width: number;
    wrapLines: boolean;
}

Element Component Properties.

Type declaration

  • alignment: number[]

    An array of 2 numbers controlling the horizontal and vertical alignment of the text relative to its element transform.

    [0.5,0.5]
    
  • anchor: number[]

    An array of 4 numbers controlling the left, bottom, right and top anchors of the element.

    [0.5,0.5,0.5,0.5]
    
  • autoFitHeight: boolean

    If true then the font size of the element will scale automatically so that it fits the element's height.

    false
    
  • autoFitWidth: boolean

    If true then the font size and the line height of the element will scale automatically so that it fits the element's width.

    false
    
  • autoHeight: boolean

    Make the height of the element match the height of the text content automatically.

    false
    
  • autoWidth: boolean

    Make the width of the element match the width of the text content automatically.

    false
    
  • batchGroupId: number

    The batch group id that this element belongs to.

    null
    
  • color: number[]

    An array of 3 numbers controlling the color of the element.

    [1,1,1]
    
  • enabled: boolean

    Whether the component is enabled.

    true
    
  • enableMarkup: boolean

    Flag for enabling markup processing. Only works for text types.

    false
    
  • fontAsset: number

    The id of the font asset used by the element.

    null
    
  • fontSize: number

    The size of the font used by the element.

    32
    
  • height: number

    The height of the element.

    32
    
  • key: string

    The localization key of the element.

    null
    
  • layers: number[]

    An array of layer id's that this element belongs to.

    [4]
    
  • lineHeight: number

    The height of each line of text.

    32
    
  • margin: number[]

    An array of 4 numbers controlling the spacing between each edge of the element and the respective anchor.

    [-16,-16,-16,-16]
    
  • mask: boolean

    Switch image element into a mask.

    false
    
  • materialAsset: number

    The id of the material asset used by this element.

    null
    
  • maxFontSize: number

    The maximum size of the font that the element can scale to when using autoFitWidth or autoFitHeight.

    32
    
  • maxLines: number

    The maximum number of lines that this element can display.

    null
    
  • minFontSize: number

    The minimum size of the font that the element can scale to when using autoFitWidth or autoFitHeight.

    8
    
  • opacity: number

    The opacity of the element.

    1
    
  • outlineColor: number[]

    An array of 4 numbers controlling the text outline effect color and opacity.

    [0,0,0,1]
    
  • outlineThickness: number

    The text outline effect width. Ranges from 0 to 1. To disable outline effect set to 0.

    0
    
  • pivot: number[]

    An array of 2 numbers controlling the origin of the element.

    [0.5,0.5]
    
  • pixelsPerUnit: number

    The number of pixels that correspond to one PlayCanvas unit.

    null
    
  • rect: number[]

    An array of 4 numbers controlling the u, v, width and height of the rectangle that represents the portion of the texture that this image maps to.

    [0,0,1,1]
    
  • shadowColor: number[]

    An array of 4 numbers controlling the text shadow cast effect color and opacity.

    [0,0,0,1]
    
  • shadowOffset: number[]

    An array of 2 numbers controlling the horizontal and vertical shift of the text shadow cast effect.

    [0,0]
    
  • spacing: number

    The spacing between each letter of the text.

    1
    
  • spriteAsset: number

    The id of the sprite asset to be used by the element.

    null
    
  • spriteFrame: number

    The frame from the sprite asset to render.

    0
    
  • text: string

    The text content of the element.

    ""
    
  • textureAsset: number

    The id of the texture asset to be used by the element.

    null
    
  • type: string

    The type of the element. Can be: pc.ELEMENTTYPE_GROUP, pc.ELEMENTTYPE_IMAGE, pc.ELEMENTTYPE_TEXT.

    "text"
    
  • useInput: boolean

    Enable this if you want the element to receive input events.

    false
    
  • width: number

    The width of the element.

    32
    
  • wrapLines: boolean

    Whether to automatically wrap lines based on the element width.

    true