@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / UIButtonComponent
Class: UIButtonComponent ​
Defined in: components/UIButton.ts:43
A pressable control.
A press is CLICK-ON-RELEASE: it arms when the pinch/trigger/mouse goes down on the button and fires only if the release still points at it — sliding off cancels, matching platform UX. Scripts hear it via Behaviour.onUiPress, on the button's own entity first and then bubbling up the parent chain, carrying actionId (defaults to the entity's name) so one panel script can handle all of its buttons.
Extends ​
Constructors ​
Constructor ​
ts
new UIButtonComponent(options?): UIButtonComponent;Defined in: components/UIButton.ts:86
Parameters ​
| Parameter | Type |
|---|---|
options? | UIButtonOptions |
Returns ​
UIButtonComponent
Overrides ​
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
label | string | - | components/UIButton.ts:44 |
actionId | string | Dispatch identifier; empty string means "use the entity name". | components/UIButton.ts:46 |
width | number | Full width in metres. | components/UIButton.ts:48 |
height | number | Full height in metres. | components/UIButton.ts:50 |
fontSize | number | Label glyph height in metres. | components/UIButton.ts:52 |
fontWeight | number | - | components/UIButton.ts:53 |
textColor | string | - | components/UIButton.ts:54 |
backgroundColor | string | - | components/UIButton.ts:55 |
backgroundOpacity | number | - | components/UIButton.ts:56 |
cornerRadius | number | - | components/UIButton.ts:57 |
borderWidth | number | - | components/UIButton.ts:58 |
borderColor | string | - | components/UIButton.ts:59 |
pixelDensity? | number | Texture density in px/metre, clamped 256–2048 at render time. Absent means the default: a defaulted field would count as a change on every instance of a prefab saved before it existed. | components/UIButton.ts:65 |
style? | UiStyle | Modern styling; wins over the flat fields above. Absent until authored. | components/UIButton.ts:67 |
icon? | string | A built-in icon name (play, settings, heart-filled…) or an image or SVG file, drawn beside the label and tinted to the text colour. With an empty label the icon fills the button. | components/UIButton.ts:73 |
iconPosition? | UiIconPosition | - | components/UIButton.ts:74 |
variant? | "primary" | "secondary" | "ghost" | "danger" | "tile" | "tab" | "icon" | How it draws under a themed panel: primary (the one main action), secondary (the default), ghost, danger, tile (a big choice card), tab or icon (round). | components/UIButton.ts:80 |
disabled? | boolean | Greyed out, and takes no hover or press. | components/UIButton.ts:82 |
selected? | boolean | Drawn as chosen: the current tab, the picked card. | components/UIButton.ts:84 |

