@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / UIPanelComponent
Class: UIPanelComponent ​
Defined in: components/UIPanel.ts:51
A flat UI surface in the world — the backdrop menus and HUDs are built on.
Size is authored in METRES on the component, never via transform scale: the canvas texture is rasterised for the authored size, so scaling the entity would stretch texels into blur. Child widgets (text, buttons, toggles, sliders) are ordinary entities parented under the panel and placed with their transforms.
follow: "billboard" yaw-faces the camera each frame; for a wrist menu, parent the panel under an XR Interactor's Left/Right slot entity instead.
Extends ​
Constructors ​
Constructor ​
ts
new UIPanelComponent(options?): UIPanelComponent;Defined in: components/UIPanel.ts:97
Parameters ​
| Parameter | Type |
|---|---|
options? | UIPanelOptions |
Returns ​
UIPanelComponent
Overrides ​
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
width | number | Full width in metres. | components/UIPanel.ts:53 |
height | number | Full height in metres. | components/UIPanel.ts:55 |
backgroundColor | string | - | components/UIPanel.ts:56 |
backgroundOpacity | number | 0–1. Panels are usually slightly translucent in XR. | components/UIPanel.ts:58 |
cornerRadius | number | Corner radius in metres. | components/UIPanel.ts:60 |
borderWidth | number | Border thickness in metres; 0 disables the border. | components/UIPanel.ts:62 |
borderColor | string | - | components/UIPanel.ts:63 |
pixelDensity | number | Texture density in px/metre, clamped 256–2048 at render time. | components/UIPanel.ts:65 |
follow | UiFollowMode | - | components/UIPanel.ts:66 |
style? | UiStyle | Modern styling; wins over the flat fields above. Absent until authored. | components/UIPanel.ts:68 |
tokens? | UiTokens | Named values widgets under this panel use as $name. The nearest panel wins, so a theme travels with the panel and one edit restyles the menu. | components/UIPanel.ts:73 |
theme? | string | A whole look for this panel and every widget under it: a built-in theme (holo, glass, minimal, neon, scifi, fantasy, paper, pixel, cartoon, terminal) or a theme .json file in the project. The nearest panel with a theme wins. Absent until authored. | components/UIPanel.ts:80 |
variant? | "inset" | "surface" | "card" | "hud" | "clear" | How a themed panel draws: surface (a menu's body, the default at the top of a tree), card (the default inside another widget), inset, hud or clear. | components/UIPanel.ts:86 |
renderer? | UiRendererMode | What draws this panel's whole widget tree. Read on the TOP panel of a tree only. Absent means auto: uikit in VR and mixed-reality projects (a scene with an XR Rig), canvas elsewhere. A tree uikit can't draw (gradients, shadows, patterns, edge highlights, cut corners, icons, characters its font lacks…) stays on canvas, and UIPanelSystem.rendererOf says why. | components/UIPanel.ts:95 |

