Paper’s style system lets you define namedDocumentation 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.
StyleTemplate objects — reusable bundles of visual and layout properties — and register them on the Paper instance. You can then apply a template by name to any element, and with style families you get automatic hover, focus, and active pseudo-state layering in one call.
StyleTemplate
AStyleTemplate is a deferred style descriptor — a bag of property setters that can be applied to one or more elements. It extends the same StyleSetterBase<T> as ElementBuilder, so every layout and appearance setter available on a builder is also available on a template.
Creating Templates
You can create aStyleTemplate directly or through the Paper.DefineStyle methods (which also register it by name):
ApplyTo (ElementHandle)
element’s style. Properties not set by the template are left at their current (or default) values.
The element to style.
ApplyTo (StyleTemplate)
other. Used internally by DefineStyle(name, inheritFrom[]) to implement style inheritance.
The target template to merge into.
Returns
other for chaining.Clone
A new
StyleTemplate with the same property values.Defining and Registering Styles
DefineStyle (no inheritance)
StyleTemplate, registers it under name, and returns it for fluent configuration.
The unique key under which the template is stored.
The new template, ready for property setters.
DefineStyle (with inheritance)
name. The parent styles must already be registered.
Name for the new template.
One or more names of previously registered templates to inherit from. Applied left-to-right so later parents override earlier ones.
The new combined template.
RegisterStyle
StyleTemplate under name. Overwrites any previously registered style with the same name.
Registration key.
The template to store.
TryGetStyle
The registration key to look up.
Receives the template if found;
null otherwise.true if a template with name exists.Style Families
A style family groups a base style with named pseudo-state variants (normal, hovered, focused, active). Calling ApplyStyleWithStates applies the base and then layers the appropriate pseudo-state style on top based on the element’s current interaction state.
Pseudo-state styles are stored internally under the naming convention "baseName:hovered", "baseName:focused", and "baseName:active".
RegisterStyleFamily
Base name (e.g.,
"button"). The base style is registered as "button"; pseudo-states as "button:hovered", "button:focused", "button:active".Applied unconditionally to all elements using this family.
Registered as
"baseName:normal" (optional).Applied when the element is hovered.
Applied when the element has keyboard focus.
Applied when the element is being pressed.
CreateStyleFamily
StyleFamilyBuilder for fluent family construction. Call .Register() at the end to commit.
Base name for the family.
A builder for chaining state assignments.
StyleFamilyBuilder
StyleFamilyBuilder is a fluent helper returned by CreateStyleFamily. All methods return the builder itself for chaining; call .Register() to finalize.
| Method | Description |
|---|---|
.Base(StyleTemplate style) | Sets the unconditional base style. |
.Normal(StyleTemplate style) | Sets the "baseName:normal" variant. |
.Hovered(StyleTemplate style) | Sets the "baseName:hovered" variant. |
.Focused(StyleTemplate style) | Sets the "baseName:focused" variant. |
.Active(StyleTemplate style) | Sets the "baseName:active" variant. |
.Register() | Commits all templates by calling RegisterStyleFamily. |
Applying Styles with Pseudo-States
ApplyStyleWithStates
baseName to element, then layers each applicable pseudo-state style on top. The order of application is: base → hovered (if hovered) → focused (if focused) → active (if active). Missing pseudo-state styles are silently skipped.
The element to style.
The base name of the style family (e.g.,
"button").ApplyStyleWithStates checks interaction state using IsElementHovered, IsElementFocused, and IsElementActive from the interaction system. These reflect the previous frame’s state during the draw phase, which is correct for smooth transitions and is identical to how CSS pseudo-classes work in retained-mode UIs.TransitionConfig
TransitionConfig describes how a style property animates from its previous value to its new value. You attach transitions via ElementBuilder.Transition(...) or the corresponding setter on StyleTemplate.
Total transition time in seconds. A
Duration of 0 means the property snaps instantly.Optional easing applied to the
0..1 interpolation progress. Use any method from the Easing static class, or null for linear interpolation.float, double, int, Color, Float2, Float3, Float4, UnitValue, Transform2D, Gradient, and BoxShadow. Unsupported types snap to the target value at the end of the transition duration.
GuiProp Enum
GuiProp identifies the style properties that can be set, transitioned, and read by the style system. It is used by StyleSetterBase<T> internally and exposed for advanced scenarios such as writing custom style setters.
Visual
BackgroundColor, BackgroundGradient, BackgroundImageBorderColor, BorderWidthRounded (corner radii as Float4)BoxShadow, BackdropBlurSizing
Width, HeightMinWidth, MaxWidthMinHeight, MaxHeightAspectRatioPositioning
Left, Right, Top, BottomMinLeft/MaxLeft, MinRight/MaxRightMinTop/MaxTop, MinBottom/MaxBottomChildren & Spacing
ChildLeft, ChildRight, ChildTop, ChildBottomRowBetween, ColBetweenPaddingLeft, PaddingRight, PaddingTop, PaddingBottomTransform
TranslateX, TranslateYScaleX, ScaleYRotate, SkewX, SkewYOriginX, OriginY, TransformText
TextColor, FontSizeLetterSpacing, WordSpacingLineHeight, TabSize