Skip to content

FocusBehavior

Defined in: ui/src/focus/FocusState.ts:21

What an element hands its own FocusState: the parts of focus only the element can answer for.

readonly focusableByDefault: boolean

Defined in: ui/src/focus/FocusState.ts:26

Whether this kind of element takes focus when the game says nothing. true for the pressable primitives, false for a panel or a label.

optional activate(): void

Defined in: ui/src/focus/FocusState.ts:39

Run the element’s own action, the one a click also runs.

void


optional adjust(direction): boolean

Defined in: ui/src/focus/FocusState.ts:45

Step the element’s own value along direction, returning true only when the press was consumed. A stepper at its end returns false, so the press moves focus out instead of being swallowed.

FocusDirection

boolean


optional isDisabled(): boolean

Defined in: ui/src/focus/FocusState.ts:28

Whether the element refuses focus and activation right now.

boolean


optional paint(focused): void

Defined in: ui/src/focus/FocusState.ts:30

Paint the focused or the resting look.

boolean

void


optional setPressed(pressed): void

Defined in: ui/src/focus/FocusState.ts:37

Paint the pressed or the unpressed look. Receives the combined press of every device holding the element, so the resting look returns only once the pointer has also let go. true can arrive more than once, so set the face; do not toggle it. An element with no pressed look leaves this out.

boolean

void

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.