Skip to content

UIFocusScopeOptions

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

How one focus scope behaves, passed as UIPanelProps.focus. All four callbacks run through the UI error boundary against the host container.

optional autoFocus?: boolean

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

Focus the first candidate in tree order the first time the scope takes input with nothing remembered. Defaults to true.


optional input?: UIFocusInputOptions | null

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

Rename the polled actions per role. null reads no device: the game drives the scope through move(), activate() and cancel(). Pointer focus and the scroll follow keep working.


optional modal?: boolean

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

Own the pointer as well as the keys while this scope reads input. Defaults to true: everything drawn outside the scope’s subtree stops answering the pointer, and a press there is claimed for the UI and does not reach the game’s action map. false leaves the world behind the panel clickable.


optional onActivate?: (element) => void

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

Called after the focused element’s own action has run.

UIElement

void


optional onCancel?: () => void

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

Called on the cancel action and on cancel().

void


optional onFocusMove?: (element, previous) => void

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

Called after focus lands somewhere else, with both elements.

UIElement | null

UIElement | null

void


optional onMoveBlocked?: (direction) => void

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

Called when a move finds nothing in that direction.

FocusDirection

void


optional pointerFocus?: PointerFocusMode

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

What pointer input does to focus. Defaults to "press".


optional scrollPadding?: number

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

Px kept between a focused element and the edge of an enclosing UIScrollView. Defaults to 8; must be finite and at or above zero.


optional wrap?: boolean

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

Wrap to the opposite end when a move runs past the last element. Defaults to true; false refuses the move.

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.