Prowl.Paper includes a complete keyboard focus and navigation system that works out of the box with zero configuration for simple cases, and provides fine-grained control when you need it. Focus determines which element receivesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl.Paper/llms.txt
Use this file to discover all available pages before exploring further.
OnKeyPressed and OnTextInput events, and Tab-key traversal lets users move focus between interactive controls without touching the mouse. This page covers how to set up Tab order, control focusability, coordinate keyboard capture with your host loop, and style focused elements.
How focus works
An element gains focus in two ways:- Click — when a focusable element is clicked, it automatically receives focus.
- Tab navigation — when the Tab key is pressed (and no multi-line text area has focus), Paper advances focus to the next element in Tab order.
FocusedElementId). Only one element can be focused at a time. When a new element gains focus, the previously focused element receives an OnFocusChange event with IsFocused = false before the new element receives one with IsFocused = true.
By default every element created with
Paper.Box, Paper.Row, or Paper.Column is focusable when clicked. To make an element non-interactive and non-focusable, call IsNotInteractable(). To keep it interactive (clickable, hoverable) but exclude it from focus, call IsNotFocusable().Tab-order navigation
TabIndex(int)
Assigns a tab-order position to an element. When the user presses Tab, Paper collects all visible, focusable elements that have a non-negative TabIndex, sorts them by that value ascending, and moves focus to the next one (wrapping from the last back to the first).
Assign TabIndex to each control
Set
TabIndex to a non-negative integer on every element you want reachable by Tab. Elements without a TabIndex (or with TabIndex(-1)) are skipped.Press Tab to advance focus
Paper sorts elements by their
TabIndex value and focuses the next in sequence. When the last element is reached, focus wraps back to the first.Excluding elements from Tab order
TabIndex(-1) is the default. Elements with TabIndex(-1) (or without any TabIndex call) are completely ignored during Tab traversal. They can still receive focus from a mouse click if they are focusable.
IsNotFocusable()
Permanently disables focus for an element. A non-focusable element cannot receive focus by any means — neither by clicking nor by Tab traversal — and will never receive OnKeyPressed, OnTextInput, or OnFocusChange events.
IsNotFocusable() does not make an element non-interactive. The element can still receive mouse events (hover, click, drag). To suppress all interaction including hit-testing, use IsNotInteractable() instead.Programmatic focus control
You can set or clear focus at any time from code using methods on thePaper instance.
paper.FocusedElementId to read the ID of the currently focused element, and paper.IsElementFocused(id) to check whether a specific element has focus.
SkipKeyboardNavigation
Paper.SkipKeyboardNavigation is a frame-level flag that suppresses Tab navigation for the current frame. When true, pressing Tab does not advance focus — instead the Tab key is passed through to the focused element’s OnKeyPressed callback.
Paper sets this flag automatically when a multi-line TextArea is focused, so that pressing Tab inserts a tab character into the text rather than moving focus away. The flag resets to false at the end of every frame.
WantsCaptureKeyboard
After every frame, paper.WantsCaptureKeyboard reports whether any element captured the keyboard during that frame. It is true whenever a TextField or TextArea is focused (because those controls call paper.CaptureKeyboard() internally from their OnPostLayout render pass).
Use this flag in your host loop to decide whether keyboard input should be forwarded to game logic:
CaptureKeyboard()
paper.CaptureKeyboard() is the method that sets WantsCaptureKeyboard = true for the current frame. It is called internally by TextField and TextArea when they are rendering in a focused state. You can call it from your own custom controls if they need to signal the host that they own keyboard input:
SetCursorVisibility(bool)
paper.SetCursorVisibility(bool visible) fires the OnCursorVisibilitySet event, which your host application should subscribe to in order to show or hide the OS cursor. Paper itself does not manage the cursor directly.
Styling focused elements
The.Focused state-driven style block applies style properties only when the element currently has keyboard focus. Use it to provide a visible focus ring or highlight, which is important for accessibility.
.Focused with transitions to animate the focus ring in and out:
Focus-within: IsParentFocusWithin
Paper mirrors the CSS :focus-within concept. IsElementFocusWithin(id) returns true if a given element or any of its descendants currently has focus. This is useful for highlighting a form group when any field inside it is active.