Skip to main content

Interface: CreateButtonDefaultedOptions

Defined in: ui/utilities/create-button.ts:51

Fields of CreateButtonOptions with a sensible default, or that are genuinely optional (no default at all); callers may omit these.

Properties​

anchor​

anchor: UiAnchorConfig

Defined in: ui/utilities/create-button.ts:57

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


anchoredPosition?​

optional anchoredPosition?: Vector2

Defined in: ui/utilities/create-button.ts:60

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


interactable?​

optional interactable?: Partial<UiInteractableDefaultedOptions>

Defined in: ui/utilities/create-button.ts:93

Overrides for the button's UiInteractableEcsComponent (e.g. to start it non-interactable, or to disable blocksRaycasts).


labelCategory?​

optional labelCategory?: number

Defined in: ui/utilities/create-button.ts:87

The render category the label's text draws with, forwarded to createLabel's category option - omitted, the label falls back to TextEcsComponent's own default (TEXT_RENDER_CATEGORY), same as any other label. Pass the same value you gave the button's canvas's cullingMask (see ScreenSpaceUiCanvasOptions.cullingMask) so the label is actually visible through it.


labelColor​

labelColor: Color

Defined in: ui/utilities/create-button.ts:77

The label's tint. Defaults to Color.black.


labelMaxWidth?​

optional labelMaxWidth?: number

Defined in: ui/utilities/create-button.ts:71

The width the label centers within, in reference pixels. Defaults to anchor.x's own size/margin value, which is only the button's actual rendered width when anchor.x is point-anchored - pass this explicitly when it's stretch-anchored instead, where that value is a margin rather than a width and can't be used to derive it (see createDropdown's option rows, which stretch to the header's width and pass that through here).


slices?​

optional slices?: NineSliceOptions

Defined in: ui/utilities/create-button.ts:74

Overrides sprite.slices for this button.


transition?​

optional transition?: Partial<UiColorTransitionDefaultedOptions>

Defined in: ui/utilities/create-button.ts:99

Overrides for the button's UiColorTransitionEcsComponent (its hover/pressed/disabled tints, transition duration, and easing).