Skip to main content

Type Alias: CreateLabelOptions

CreateLabelOptions = TextRequiredOptions & Partial<TextDefaultedOptions> & object

Defined in: ui/utilities/create-label.ts:17

Type Declaration​

anchor?​

optional anchor?: UiAnchorConfig

The anchor to place the label with - see UiAnchor for common presets (e.g. UiAnchor.center({ x: 200, y: 60 })). Defaults to UiAnchor.center().

anchoredPosition?​

optional anchoredPosition?: Vector2

Offset of the label's pivot from its anchor reference point, in reference pixels.

sizeToText?​

optional sizeToText?: boolean

When true, attaches a LayoutElementEcsComponent with sizeToText: true, so a parent layout group measures this label by its own shaped text bounds instead of its own rect. Also defaults verticalAlign to 'bottom' (unless explicitly overridden) - a layout-arranged child is always forced to a bottom-left pivot (see placeChild's doc comment in ui-layout-group-system.ts), and verticalAlign's own default ('top') assumes a top pivot instead, which renders the text a full line-height below its own sizeToText-measured box rather than inside it. Defaults to false.