Elements are the building blocks of every Paper UI. You create them by callingDocumentation 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.
Box, Row, or Column on the Paper instance, configure them with the fluent ElementBuilder API, and enter their scope with .Enter(). Custom rendering, hierarchy manipulation, the ID stack, and per-element key-value storage are all covered here.
Element Creation
Every creation method returns anElementBuilder so you can chain style and event setters. Elements are parented to CurrentParent automatically. Each element must have a unique combination of its string ID, integer ID, and source line number within its parent scope — Paper throws if a collision is detected.
Box
A descriptive string identifier. Combined with
intID and lineID to produce a stable hash key across frames.An integer discriminator. Increment this inside loops to give each iteration a unique ID without needing a unique string per element.
Source line number, supplied automatically by the compiler via
[CallerLineNumber]. Override only when calling from inside a wrapper method that hides the real call site.A fluent builder for applying styles, events, and layout properties to the newly created element.
Row
Box(...) followed by .LayoutType(LayoutType.Row). Children are arranged horizontally left-to-right.
String identifier.
Integer discriminator for loops.
Auto-supplied source line.
Builder with horizontal layout pre-configured.
Column
Box(...) followed by .LayoutType(LayoutType.Column). Children are arranged vertically top-to-bottom.
String identifier.
Integer discriminator for loops.
Auto-supplied source line.
Builder with vertical layout pre-configured.
Custom Drawing
Paper lets you attach arbitrary canvas draw callbacks to any element. Background callbacks fire before children are rendered; foreground callbacks fire after children, making them suitable for overlays and decorations.Draw (current element)
renderAction to CurrentParent. The callback receives the canvas and the element’s computed layout rectangle.
A delegate invoked during the render phase.
Canvas is Paper’s underlying draw API; Rect is the element’s bounding box in screen space.Draw (explicit handle)
The element to attach the draw callback to.
The draw callback.
DrawForeground (current element)
Draw, but the callback runs after all children have been rendered — useful for borders or tooltips that must appear on top of child content.
Foreground draw callback.
DrawForeground (explicit handle)
The element to attach the foreground callback to.
Foreground draw callback.
Paper does not automatically save and restore canvas state around your draw callbacks. If your callback changes stroke color, transform, or scissors, reset those before the callback returns.
Element Lookup
FindElementByID
ID matches. Returns a default (invalid) ElementHandle when not found.
The integer element ID to search for.
A valid
ElementHandle if found, or a default invalid handle otherwise. Check handle.IsValid before use.Hierarchy Management
MoveToRoot
CurrentParent from its current parent to the root element. Call this inside an element’s scope to make it render on top of everything — ideal for popups, modals, and tooltips. Combine with a high Layer value to guarantee draw order.
PushID (string)
id and pushes the result onto the ID stack, creating an isolated scope so that element IDs created inside are disambiguated from identically-named elements in sibling scopes.
A string whose hash is mixed into subsequent element IDs.
PushID (int)
An integer mixed into subsequent element IDs.
PopID
PushID must be paired with exactly one PopID. Attempting to pop the root ID throws an exception.
Element Storage
Paper provides a lightweight per-element key-value store that persists across frames for as long as the element is recreated each frame. Storage is cleaned up automatically when an element is not recreated. This is the same backing store used internally by all animation primitives.GetElementStorage<T> (current element)
CurrentParent’s storage bucket.
Arbitrary string key.
Value returned when the key does not exist.
The stored value, or
defaultValue.GetElementStorage<T> (explicit element)
The element whose storage to read from.
Key to look up.
Fallback value.
The stored value, or
defaultValue.SetElementStorage<T> (current element)
Key to write.
Value to store.
SetElementStorage<T> (explicit element)
Target element.
Key to write.
Value to store.
HasElementStorage
Element to inspect.
Key to check.
true if the key exists in the element’s storage bucket.GetRootStorage<T>
Paper instance — not just the current element’s lifetime.
Key to read.
The stored value, or
default(T) if absent.SetRootStorage<T>
Key to write.
Value to store.
ResetRichText
el, forcing a full re-layout and replaying any typewriter, shake, or other inline effects from the beginning next frame. A no-op if no rich-text cache exists yet.
The element whose rich-text cache should be cleared.
Layout Unit Helpers
These helpers onPaper are thin wrappers around the static UnitValue factory methods, provided for ergonomic use in fluent chains without needing to import the layout engine namespace.
Stretch
factor.
Relative weight among stretch siblings.
A stretch-typed
UnitValue.Pixels
Size in logical pixels.
A pixel-typed
UnitValue.Percent
Percentage in the range
0..1 (e.g., 0.5 = 50%).Pixel offset added after the percentage is resolved.
A percentage-typed
UnitValue.Auto
UnitValue.Auto, signalling that the layout engine should determine this dimension automatically (e.g., from parent defaults or sibling spacing rules).
An auto-typed
UnitValue.