Every interactive element in Prowl.Paper exposes a rich set of event callbacks that you attach to anDocumentation 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.
ElementBuilder using method chaining. Events are dispatched by the framework at the end of each frame after hit-testing is complete, and they automatically bubble up the element hierarchy so that parent containers can react to activity that originates in their children. This page documents every available callback, its event-data type, and how to use it correctly.
Base event type: ElementEvent
All pointer-related event classes inherit from ElementEvent, which carries the context data shared across mouse, drag, scroll, and hover events.
Mouse events
Mouse events all useClickEvent, which extends ElementEvent with a Button and a Phase discriminator. Paper evaluates press/hold/release as separate phases so you can attach multiple callbacks to the same element and handle each transition independently.
OnClick — press + release on the same element
Fired once when the left mouse button is pressed and released over the same element without dragging.
OnPress — mouse-button-down
Fires the instant the left button goes down over the element, before release.
OnHeld — every frame while held
Fires every frame for as long as the left button remains held over the element. Useful for continuous actions like charging an attack or scrolling a list manually.
OnRelease — mouse-button-up
Fires when the left button is released, regardless of whether the pointer is still over the element. Always paired with a prior OnPress.
OnDoubleClick — rapid double-click
Fires when two left-button presses occur within the double-click time window (250 ms by default) and the pointer has not moved significantly between them.
OnRightClick — right mouse button
Fires when the right mouse button is pressed over the element. Uses PaperMouseBtn.Right as the Button value.
Drag events
Dragging begins when the left button is held and the pointer moves at least 5 pixels from the initial press position. Drag events useDragEvent:
OnDragStart — drag threshold crossed
OnDragging — pointer moving while held
Called every frame while the drag is active. Use e.Delta for frame-relative movement or e.TotalDelta for the total displacement from the start.
OnDragEnd — button released after dragging
Scroll event
OnScroll fires when the mouse wheel moves over the element. The ScrollEvent adds a single Delta field (positive = scroll up, negative = scroll down).
Hover events
Hover events use the baseElementEvent type directly. They fire purely in response to pointer position — no button state is involved.
OnHover — pointer is over the element (every frame)
Fires every frame while the pointer is anywhere inside the element’s layout rect.
OnEnter — pointer enters the element
Fires once on the first frame the pointer crosses into the element’s bounds.
OnLeave — pointer exits the element
Fires once on the frame the pointer leaves the element’s bounds.
Keyboard events
Keyboard events are delivered only to the focused element. An element becomes focused when clicked (if it is focusable) or via Tab navigation.OnKeyPressed — key pressed or auto-repeated
Uses KeyEvent:
OnTextInput — printable character typed
Fires for every character that reaches the text input queue. The character has already been filtered for control characters by the host’s AddInputCharacter call.
OnFocusChange — element gains or loses focus
Layout callback: OnPostLayout
OnPostLayout fires after the layout engine has computed the final dimensions and position of the element. Use it to perform measurements or to register custom draw calls that depend on the computed rect.
Event bubbling
When an event fires on an element, it automatically bubbles up through every ancestor in the hierarchy. This means anOnHover on a container fires whenever the pointer is over any of its children, not just the container itself.
StopPropagation() on the event object inside the callback:
StopEventPropagation() on the builder:
Element interaction flags
IsNotInteractable()
Marks the element as a visual-only element. It is completely excluded from hit-testing: the pointer passes through it as though it were not there, and no events will ever fire on it.
HookToParent()
Makes the element inherit its parent’s interaction state. A hooked element is considered hovered, active, focused, and dragging whenever its parent is. All of its event callbacks are also invoked when the parent’s corresponding events fire. This is useful for sub-elements like icons inside a button that should visually respond as if they were the button itself.
Closure-free captured-value overloads
Every event callback has a generic overload that accepts a captured value parameter. These overloads exist to avoid heap-allocating a lambda closure when you need to pass loop-local data into a callback — a common source of unnecessary GC pressure in immediate-mode code.OnClick<T>, OnPress<T>, OnHeld<T>, OnRelease<T>, OnDoubleClick<T>, OnRightClick<T>, OnDragStart<T>, OnDragging<T>, OnDragEnd<T>, OnScroll<T>, OnHover<T>, OnEnter<T>, OnLeave<T>, OnKeyPressed<T>, OnTextInput<T>, OnFocusChange<T>, and OnPostLayout<T>.
State-driven styling with event states
You can combine event callbacks with state-driven style blocks to keep visual feedback and logic together on the same element chain.Style state blocks (
.Hovered, .Active, .Focused) are evaluated every frame based on Paper’s internal interaction state — they do not require any event callbacks to be registered.