Skip to content

UISurfaceOptions

Defined in: ui/src/types.ts:879

Options for creating a UISurface (the Component that mounts a UI tree on an entity).

The surface takes the root panel’s props. new UISurface({ focus: true }) turns the whole surface into one focus scope, reached through surface.focusScope.

optional alignItems?: AlignItems

Defined in: ui/src/types.ts:619

UIPanelProps.alignItems


optional alignSelf?: "auto" | "center" | "flex-start" | "flex-end" | "stretch" | "baseline"

Defined in: ui/src/types.ts:157

UIPanelProps.alignSelf


optional anchor?: Anchor

Defined in: ui/src/types.ts:880


optional background?: BackgroundOptions

Defined in: ui/src/types.ts:622

UIPanelProps.background


optional bottom?: PositionValue

Defined in: ui/src/types.ts:183

Offset from the containing block’s bottom edge — px or "<n>%" (only applies to position: "absolute").

UIPanelProps.bottom


optional consumeInput?: boolean

Defined in: ui/src/types.ts:264

UIPanelProps.consumeInput


optional direction?: FlexDirection

Defined in: ui/src/types.ts:616

UIPanelProps.direction


optional flex?: number

Defined in: ui/src/types.ts:156

Shorthand for the common CSS flex: <number> case — expands to flexGrow: <number>, flexShrink: 1, flexBasis: 0. Use it for a child that should fill the remaining main-axis space (e.g. the text column between a fixed icon and a fixed button): sizing from a 0 basis means it won’t claim its content width and push its siblings, and its text wraps cleanly. Prefer this over flexGrow: 1 alone, which keeps flexBasis: auto (content width) and overflows. Explicit flexGrow/flexShrink/flexBasis override the parts this expands to.

UIPanelProps.flex


optional flexBasis?: LayoutValue

Defined in: ui/src/types.ts:145

UIPanelProps.flexBasis


optional flexGrow?: number

Defined in: ui/src/types.ts:143

UIPanelProps.flexGrow


optional flexShrink?: number

Defined in: ui/src/types.ts:144

UIPanelProps.flexShrink


optional focus?: boolean | UIFocusScopeOptions

Defined in: ui/src/types.ts:640

Make this panel a focus scope over its descendants, so keyboard and gamepad input walks them. true takes every default; an object sets them. Reached afterwards through panel.focusScope. By default the scope also owns the pointer; see UIFocusScopeOptions.modal.

Passing focus again through update() refreshes the existing scope’s options and keeps focus where it is. false or an explicit undefined disposes the scope.

UIPanelProps.focus


optional focusable?: boolean

Defined in: ui/src/types.ts:376

Take part in focus navigation. Defaults to true for UIButton, UICheckbox and the six interactive @pixi/ui wrappers, false for everything else. false leaves the element enabled for the pointer.

UIPanelProps.focusable


optional focusBackground?: BackgroundOptions

Defined in: ui/src/types.ts:629

Background painted while a focusable panel holds focus. Omitted, a focused panel keeps its resting background. An override supplying only a colour keeps the resting corner radius. A panel with no background paints this fill while focused and nothing at rest.

UIPanelProps.focusBackground


optional focusId?: string

Defined in: ui/src/types.ts:382

Name this element so a sibling’s FocusProps.focusNeighbors can point at it. Unique inside one scope: a duplicate id draws a development warning, and the first element in tree order answers to it.

UIPanelProps.focusId


optional focusNeighbors?: FocusNeighbors

Defined in: ui/src/types.ts:384

Per-direction overrides of the position rule.

UIPanelProps.focusNeighbors


optional focusStyle?: UIFocusStyle | null

Defined in: ui/src/types.ts:401

The focus outline for this element alone. Each field falls back to the plugin-level focusStyle, then to the built-in default. null draws no outline on this element.

UIPanelProps.focusStyle


optional gap?: number

Defined in: ui/src/types.ts:617

UIPanelProps.gap


optional height?: LayoutValue

Defined in: ui/src/types.ts:135

UIPanelProps.height


optional justifyContent?: JustifyContent

Defined in: ui/src/types.ts:620

UIPanelProps.justifyContent


optional layer?: string

Defined in: ui/src/types.ts:889

Target UI layer name on the scene’s render tree. Defaults to UI_DEFAULT_LAYER ("ui"), which is auto-provisioned as a screen-space layer via SceneRenderTreeKey.ensureLayer(...) on first use. Any other explicit name must be declared on the scene’s readonly layers or the component throws on add.


optional left?: PositionValue

Defined in: ui/src/types.ts:177

Offset from the containing block’s left edge — px or "<n>%" (only applies to position: "absolute").

UIPanelProps.left


optional margin?: number | { bottom?: number; left?: number; right?: number; top?: number; }

Defined in: ui/src/types.ts:140

UIPanelProps.margin


optional maxHeight?: LayoutValue

Defined in: ui/src/types.ts:139

UIPanelProps.maxHeight


optional maxWidth?: LayoutValue

Defined in: ui/src/types.ts:137

UIPanelProps.maxWidth


optional minHeight?: LayoutValue

Defined in: ui/src/types.ts:138

UIPanelProps.minHeight


optional minWidth?: LayoutValue

Defined in: ui/src/types.ts:136

UIPanelProps.minWidth


optional offset?: object

Defined in: ui/src/types.ts:881

x: number

y: number


optional onAdjust?: (direction) => void

Defined in: ui/src/types.ts:395

Called with -1 for left and 1 for right while this element is focused, consuming that press. Up and down still move focus.

-1 | 1

void

UIPanelProps.onAdjust


optional onFocusChange?: (focused) => void

Defined in: ui/src/types.ts:390

Called with true when focus arrives and false when it leaves, including when the scope stops taking input. Use it to show focus without an outline: a marker beside the row, a swapped sprite, a sound.

boolean

void

UIPanelProps.onFocusChange


optional onHover?: (hovering) => void

Defined in: ui/src/types.ts:286

boolean

void

UIPanelProps.onHover


optional onPointerOut?: () => void

Defined in: ui/src/types.ts:285

void

UIPanelProps.onPointerOut


optional onPointerOver?: () => void

Defined in: ui/src/types.ts:284

void

UIPanelProps.onPointerOver


optional overflow?: "visible" | "hidden"

Defined in: ui/src/types.ts:621

UIPanelProps.overflow


optional padding?: Padding

Defined in: ui/src/types.ts:618

UIPanelProps.padding


optional position?: "relative" | "absolute"

Defined in: ui/src/types.ts:175

Positioning mode for this element relative to its parent. Defaults to "relative" — the element flows in the parent’s flex layout. Set to "absolute" to lift the element out of the flow and pin it via left / top / right / bottom against the parent’s content box.

A position: "relative" ancestor acts as the containing block for any absolute-positioned descendants — useful for HUD overlays, modal backdrops, and badge markers. See <ZStack> in @yagejs/ui-react for an opinionated overlay primitive.

UIPanelProps.position


optional positioning?: UIPositioning

Defined in: ui/src/types.ts:905

How the surface’s root container is positioned each frame.

  • "anchor" (default) — resolve anchor against the viewport (virtualSize). Classic HUD/menu behavior.
  • "transform" — read entity.get(Transform).worldPosition and reinterpret anchor as the pivot on the panel itself (e.g. BottomCenter → panel’s bottom-center sits at the Transform). Requires a Transform on the entity. The panel is positioned in the layer’s local coords, so this plays with any layer type: screen-space layers (paired with a ScreenFollow component that writes projected screen coords) for constant-size billboards, or world-space layers for genuinely diegetic UI that scales with the camera.

optional right?: PositionValue

Defined in: ui/src/types.ts:181

Offset from the containing block’s right edge — px or "<n>%" (only applies to position: "absolute").

UIPanelProps.right


optional rotation?: number

Defined in: ui/src/types.ts:199

Rotation in radians about LayoutProps.transformOrigin. Default 0.

UIPanelProps.rotation


optional scale?: number | { x: number; y: number; }

Defined in: ui/src/types.ts:197

Scale about LayoutProps.transformOrigin, one number for both axes or one per axis. Default 1. 0 and negative values are allowed.

UIPanelProps.scale


optional top?: PositionValue

Defined in: ui/src/types.ts:179

Offset from the containing block’s top edge — px or "<n>%" (only applies to position: "absolute").

UIPanelProps.top


optional transformOrigin?: number | { x: number; y: number; }

Defined in: ui/src/types.ts:192

The point scale and rotation turn about, as fractions of the element’s computed size: 0 is the top-left corner, 0.5 the centre, { x: 0.5, y: 1 } the middle of the bottom edge. Default 0. This prop, scale, rotation and zIndex change how the element is drawn, never its Yoga box.

UIPanelProps.transformOrigin


optional visible?: boolean

Defined in: ui/src/types.ts:184

UIPanelProps.visible


optional width?: LayoutValue

Defined in: ui/src/types.ts:134

UIPanelProps.width


optional zIndex?: number

Defined in: ui/src/types.ts:206

Draw and pointer order among the siblings in the same container: a higher value draws on top and takes the pointer first. Default 0; siblings with equal values keep the order they were added in. To rise above an element in a neighbouring container, raise that container.

UIPanelProps.zIndex

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/ui.md.