Table of Contents

Namespace Velvet

Namespaces

Velvet.Experimental

Classes

AnimatePresenceNode

Container node that manages mount / unmount animations of its children. When keyed children become null, it does not delete them immediately and retains them until the exit animation completes. Children should preferably be MotionNode. Non-MotionNode children (e.g. ElementNode) also work as transition-less (immediate deletion), but a Debug.LogWarning is emitted because they are not animation targets. TextNode is skipped without a warning. Note: FragmentNode cannot be included directly as a child (it is not expanded). Use MotionNode or a direct VNode. Children without a key receive a position-based automatic key, so reordering can cause unintended exit / enter animations. Set explicit keys on children that participate in animation.

BaseElementNode

Base class shared by ElementNode and MotionNode. ClassNames / Children / Events default to empty arrays so derived nodes can omit them when unused.

BlurBinding
ChangeEventBinding<T>

Binding for BaseField<T>.RegisterValueChangedCallback events.

ChoicesSettings

List of choices for DropdownField / RadioButtonGroup.

ClickedBinding

Binding for the Button.clicked event.

ComponentAttribute

Registers a functional component (static VNode XxxComp()) as a Velvet component.

ComponentContext<T>

Typed context definition that lets a value be supplied by an ancestor Provider and read by any descendant via UseContext. Holds the default value returned when no Provider is configured.

ComponentFiber

Identity that persists across re-renders for one component instance. Forms a parent/child linked-list tree via Parent / Child / Sibling pointers, and holds hook slots / context dependencies / refs / error boundary / suspense boundary.

ComponentMethodRegistry

Process-global registry of methods annotated with [Component(IsErrorBoundary = true)] and [Component(DisplayName = "...")]. Populated by Source-Generator-emitted [ModuleInitializer] hooks at startup; consumed by V.Component on every render and by hook-rule violation paths.

ComponentNode

Node that embeds a child component into a VNode tree. Holds the function-style component ([Component] static VNode) as a Body delegate and its function identity (MethodInfo) in Identity.

ContextProviderNode

Non-generic base for a Context Provider. Note: a single wrapper VisualElement is added to the DOM for the Provider (each VNode maps to one DOM element), so consider the impact on USS selectors and layout.

ContextProviderNode<T>

Node that provides a context value to a subtree, read by descendants via UseContext.

ElementNode

Node corresponding to a VisualElement (the host primitive, e.g. div, button).

ErrorInfo

Diagnostic data passed to Hooks.UseFallback's 2-arg overload when an Error Boundary catches a descendant render exception. Carries the caught error together with the component stack of the throwing subtree.

FiberElementProps

Type-safe property bag for a VNode (text, tooltip, enabled/visible, field value, and element-specific settings), passed as the props: argument of the V.* factories.

FiberEventBinding

Abstract base for event bindings. Uses an "unbind all → bind all" diff strategy (event count is typically 1-3, so this is lightweight).

FiberPortalRegistry

Registry that registers and retrieves the destination VisualElement for a Portal. A Portal renders its children into the container looked up here by id, rather than into its own position in the tree. Not thread-safe (main thread only).

FocusBinding
FocusInBinding
FocusOutBinding
FragmentNode

Node that returns multiple nodes without a wrapper element (a Fragment).

GeometryChangedBinding
HookServiceContext

Provides the host IHookServiceResolver to descendant components through the Velvet Provider tree. UseService<T>() reads Ref and throws when no Provider has supplied a resolver.

Hooks

Single entry point for all hooks invoked from a [Component] static VNode body. Hooks may only be called during Render(), unconditionally and in a stable order (the Rules of Hooks). For example, UseState<T>(T) returns the 2-tuple (value, setValue) where setValue is a StateUpdater<T> accepting either a replacement value (setValue.Invoke(next)) or a functional updater (setValue.Invoke(prev => next)).

KeyDownBinding
KeyUpBinding
MemoNode

Node that skips rebuilding its child tree when the dependency array is unchanged. When omitting key, do not change the order of MemoNodes within the same component, since identity is resolved by call order.

MemoizeAttribute

Marks a method as a per-method auto-memoization target recognized by the Source Generator. The annotated partial method is expanded into a V.Memoized(...) wrapper.

MotionNode

Element node that participates in animations. A variant Initial/Animate pair plays its mount enter on ANY Motion, standalone or under AnimatePresence; Exit requires AnimatePresence (something must defer the unmount for the removal to animate against) and switches CSS classes on unmount based on the transition definition. Inline styles (StyleOverrides) are intentionally not supported. Apply styles via USS classes.

MountedTree

Handle to a tree created by V.Mount. Unmounts on Dispose.

MutableRef<T>

Mutable slot holder with no type constraint, for non-element values held across renders.

MutationOptions

Options for a void mutation that takes no input and returns no data. Common for "save current state" / "logout" / "reset" actions where everything is captured in closure.

MutationOptions<TVariables>

Options for a void mutation that takes TVariables input but returns no data. Use this overload when the mutation is fire-and-forget (typical for Store actions that update state internally).

MutationOptions<TVariables, TData>

Options passed to UseMutation<TVariables, TData>(MutationOptions<TVariables, TData>). The MutationFn is the async function invoked by Mutate(TVariables) / MutateAsync(TVariables).

MutationResultExtensions

Convenience extensions for mutations that take Unit as input. Allows callers to omit the explicit Unit.Default argument: mutation.Mutate() instead of mutation.Mutate(Unit.Default).

MutationResult<TVariables, TData>

Mutation handle returned by UseMutation<TVariables, TData>(MutationOptions<TVariables, TData>). Exposes Status flags + Data / Error / Variables snapshots + Mutate(TVariables) / MutateAsync(TVariables) / Reset() imperative API.

NavigationAttempt

Information about a navigation attempt passed to a Blocker. Provides the basis (current path, target path, mode) for the block decision.

NullStoreLogger

No-op logger for tests.

OutletNode

Placeholder node that renders the matched child route component of a nested route at this position. Dynamically renders the next child route in the matched route hierarchy based on RouterContext depth.

ParticlesElement

The element behind Particles(ParticleSystem?, string?, string?, string?, PlayTrigger, float, StyleOverrides?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?): draws a hidden ParticleSystem simulation as textured quads in its own visual content. A dedicated subclass so a type change to or from any other element remounts instead of patching, and so the element is never recycled through the shared primitive pools while it owns a live simulation host.

ParticlesSettings

The particle effect a Particles element simulates and draws: the source effect (a prefab's ParticleSystem — the framework instantiates a hidden simulation host from it and owns that instance), the play trigger, and the world-unit → element-pixel mapping. The constructor fail-fasts on a non-positive or NaN mapping so every construction path shares one guard; a with expression bypasses it like any record init.

PointerDownBinding
PointerEnterBinding
PointerLeaveBinding
PointerMoveBinding
PointerUpBinding
PortalNode

Node that renders children into a different VisualElement registered in FiberPortalRegistry, rather than at their position in the VNode tree. Used when a component's children are logically scoped to it but should be placed near the DOM root, such as modals or overlays.

PureAttribute

Marker attribute used by the Source Generator / Analyzer to treat a method as pure. Velvet can declare purity standalone, without depending on System.Diagnostics.Contracts.PureAttribute or JetBrains Annotations. The declaration is trusted and not verified.

Ref<T>

Reference holder for an element or imperative handle. Receives a VisualElement-derived type via refCallback:, and can also hold any handle interface exposed by UseImperativeHandle.

RouteBlockerManager

Registry of navigation blockers for a Router. A registered blocker can veto or defer a navigation attempt (e.g. an unsaved-changes prompt); backs the UseBlocker hook.

RouteBlockerState

State object held by an individual Blocker. UI components observe this object to drive the display of a block dialog.

RouteDefinition

Route definition. Construction via the V.Route() DSL is recommended (it performs exclusivity validation). When constructed directly, specifying RedirectTo and Guard together throws during NavigateAsync.

RouteLoaderContext

Context passed to Guard / Loader functions. Provides path parameters and the resolved path of the matched route.

RouteMatch

One entry in a route matching result. For nested routes, an entry is produced for each level.

RouteTree

Matching engine over the route definition tree. Flattens the tree into ranked branches: every leaf route is paired with its full ancestor chain, each branch is scored for specificity, and Match(string) returns the highest-scoring branch whose pattern matches the path. Matching is therefore best-match, not declaration-order. Supports literal, dynamic (:param), optional (:param? / segment?), and splat (*) segments.

Router

Navigation controller: matches paths against a route tree, runs guards / blockers / loaders, and maintains a history stack with Back/Forward. The active instance is exposed as Current.

RouterContext

Static contexts that propagate router information through the Velvet component tree. Router writes to them as the Provider; child components read via UseContext.

RouterLocation

Information about the current location after a navigation.

SceneViewElement

The element behind SceneView(Camera?, string?, string?, string?, float, StyleOverrides?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?): displays a Camera's output as its background image, from a framework-owned RenderTexture sized to the element's laid-out rect. A dedicated subclass (rather than reusing another element type) so a type change to or from any other element remounts instead of patching, and so the element is never recycled through the shared primitive pools while it owns a live RenderTexture. While the camera texture is live it owns the element's backgroundImage: every other writer routes through Velvet.SceneViewElement.WriteBackground(UnityEngine.UIElements.VisualElement, UnityEngine.UIElements.StyleBackground), which defers the value instead of clobbering the feed and restores it when the camera releases.

SceneViewSettings

The camera a SceneView element displays, plus its render-resolution policy. The framework owns the RenderTexture: it is created at the element's laid-out pixel size (times ResolutionScale), follows geometry changes, and is released on unmount. The constructor fail-fasts on a non-positive or NaN scale so every construction path (the factory, wrapper hosts, direct construction) shares one guard; a with expression bypasses it like any record init.

ScrollViewSettings

Controls ScrollView scroller visibility and touch-scroll behavior.

SearchParams

Default ISearchParams implementation backed by an ordered multi-value map. Build one with Append(string, string) to pass to the search-params setter; the parser produces these from a query string. Enumerating an instance yields its distinct keys in insertion order.

SearchParamsSetter

The setter returned by UseSearchParams(). It accepts either the next params directly or a functional updater (prev) => next, and defaults to a PUSH navigation (so Back returns to the previous query) — pass Replace to overwrite the current entry instead.

SliderSettings

Slider.lowValue / highValue. Record structural equality simplifies DiffProps.

StoreLogger

Logger for Store. Self-contained within Velvet. Swap Default in tests to suppress log output.

StoreShallowEqualityComparer

Shallow equality comparers for selector return values that are sequences. Reference-equal elements at matching positions and matching lengths are considered equal; deep equality is intentionally not performed.

Store<TState>

State container: immutable state plus collocated actions in a single class, with synchronous subscribers notified on every change.

StyleBackgroundImageResolver

Parses utility-style arbitrary-value background-image className syntax and applies the result as an inline UnityEngine.UIElements.IStyle.backgroundImage.

StyleClassNames

Conditional class-name concatenation utility. Filters out null/empty entries and joins them with spaces.

StyleFontClass

Parses Velvet's font utility classes — font-<name> (family), font-thinfont-black (weight), italic / not-italic / bold-italic (style), plus the arbitrary font-[…] forms — into a single FontIntent. Mirrors Velvet.StyleGapClass's whole-array, last-wins extraction so it slots into the reconciler the same way. Resolution to actual assets/styles is done by StyleFontResolver.

StyleFontResolver

Applies an element's font utility classes as inline style, resolving family + weight + italic together against the VelvetFonts registry. Setting unityFontDefinition and unityFontStyleAndWeight in one pass is what lets Velvet:

  • compose font-bold italic into bold-and-italic (impossible from two separate USS classes that share the single -unity-font-style property);
  • render the full font-thinfont-black scale when weight-specific Font Assets are registered, and gracefully fold to the binary bold/normal threshold when they are not.

Inline styles win over the USS fallback classes in _typography.uss, so this resolver is the authoritative font layer for every Velvet element.

StyleOverrides

Limited set of inline styles applied directly to an element. Intentionally inconvenient to encourage class-based styling.

StyleRecipe

Class-name builder utility with named variant axes. Specify a value for each variant axis (visual, size, etc.) and expand to the corresponding classes.

StyleRecipe.CompoundVariant

Compound variant that applies an extra class when multiple axis conditions all match.

StyleSlotRecipe

Defines class names for UI patterns with multiple slots (parts) in one place. Each slot can have a base class and variant axes.

StyleSlotRecipe.SlotCompoundVariant

Adds classes to slots when a compound condition matches.

StyleTransition

Predefined transition presets for V.Motion. All presets animate only translate / scale / opacity, so they never trigger a layout recomputation. Override duration / easing per use via With(float?, EasingMode?, EasingMode?, float?), e.g. StyleTransition.Fade.With(durationSec: 0.5f).

StyleTransitionConfig

CSS-transition-based animation configuration for V.Motion. Drives a USS class swap (enter-from → enter-to / exit-from → exit-to); DurationSec / Easing are applied as inline styles. Use the presets on StyleTransition, optionally tuned via With(float?, EasingMode?, EasingMode?, float?).

StyleVariantClass

Parses a state-variant utility token of the form <variant>:<payload> (e.g. hover:bg-blue-500, focus:border-accent, active:w-[200px]).

USS class selectors cannot contain :, so these tokens are never added to the class list; the reconciler routes them to a Velvet.StyleVariantManipulator that toggles the payload when the matching pointer/focus state is active. The payload itself is an ordinary utility — a USS class (bg-blue-500) or an arbitrary value (w-[200px]).

SuspenseNode

Boundary node that displays a fallback when a descendant Use<T> declares pending. Error handling is delegated to an Error Boundary.

TextFieldSettings

TextField.isPasswordField.

TextNode

Text-only node. Converted to a Label.

V

VNode builder DSL. Declarative UI construction API for composing element trees in C#.

VNode

Abstract base for virtual DOM nodes. The smallest unit of a declarative element tree.

VelvetFilters

Registry for user-defined UI Toolkit custom filters consumed by the filter-[name:args] utility. Register a UnityEngine.UIElements.FilterFunctionDefinition under a name at startup (before the consuming tree mounts), then reference it from any class string:

VelvetFilters.Register("dissolve", dissolveDefinition);
V.Div(className: "filter-[dissolve:0.4]");

Arguments after the name are colon-separated and fill the definition's declared parameters in order, parsed by each slot's declared type — floats (filter-[dissolve:0.4], sign allowed) for float slots and colors (filter-[glow:#ff0000:2]) for color slots; a missing tail is padded from the declaration's defaults, so a bare name (filter-[dissolve]) applies the declared defaults outright. Custom functions compose into the same inline filter list as the built-in blur-/contrast-/… utilities: built-ins first (canonical CSS order), then customs in class order. Registration is not reactive: a class resolved before its name was registered stays inert until the element's class list changes again. Not thread-safe (main thread only).

VelvetFontFamily

A named font family — the Velvet counterpart of a font-family entry. A family owns one or more VelvetFontWeightEntry slots keyed by VelvetFontWeight, and is selected through the font-<name> utility class (e.g. font-sans → the family named "sans").

Multilingual (CJK / fallback) coverage is a property of the Font Assets themselves: configure the local fallback table on the Font Asset, or the global fallback list on the panel's UITK Text Settings. Velvet only selects which family/weight asset to assign — TextCore performs the per-glyph fallback at render time.

VelvetFontWeightEntry

One weight slot of a VelvetFontFamily: the upright and italic Font Assets for a single VelvetFontWeight. Each asset can be supplied either as a direct reference (upright / italic) or as an Addressables key (uprightAddress / italicAddress) that VelvetFonts loads and caches on first use. A direct reference always wins over an address.

VelvetFonts

Application-wide font registry backing the font-<name> / font-<weight> utilities. Mirrors VelvetTheme's "global state + change event" shape: register families once at startup and swap the active set at runtime (e.g. on a locale change) — FontsChanged lets the app trigger a re-render so mounted elements re-resolve.

The registry is independent of how the master data is stored. It only consumes VelvetFontFamily values via Register(VelvetFontFamily?) / Register(IEnumerable<VelvetFontFamily>?, string?); producing those from CSV, MasterMemory, a ScriptableObject, or plain code is an adapter concern that lives outside this class.

Font Assets may be supplied directly or by Addressables key; keyed assets are loaded synchronously and cached on first use, the same mechanism StyleBackgroundImageResolver uses for bg-[addr:…].

VelvetResponsive

Public entry points for Velvet's responsive system, for consumers that need to reference its conventions from code rather than only as utility-class strings.

VelvetTheme

Global theme state backing the dark: utility variant. This models a class-based dark-mode strategy as a single application-wide flag rather than scanning for an ancestor .dark class (UI Toolkit has no class-change event to react to cheaply).

Set IsDark from your app (e.g. on a settings toggle); every mounted element with a dark: variant re-evaluates its payload when the value changes.

VirtualListNode

List virtualization node for large item collections. Renders a ScrollView of fixed-height items and keeps only the items in view present in the DOM to ensure performance.

WheelBinding
WorldSpaceNode

A portal into a framework-owned world-space panel positioned by a scene transform — UI that lives among 3D content (depth-tested), unlike the always-on-top screen-space layers. Children stay part of the logical tree (context crosses; events do not — the panel boundary is physical).

Structs

FontIntent

The combined font request extracted from an element's class list: a family, a weight, and an italic flag, each tracked with a "was it specified?" companion. Because all three facets are gathered together (rather than applied class-by-class), font-bold italic composes into a single bold-and-italic result — something the raw -unity-font-style property cannot express from two independent classes.

NavigationState

Snapshot of the active navigation exposed by Hooks.UseNavigation, restricted to Idle / Loading.

ResolvedFont

Outcome of resolving a (family, weight, italic) request against the VelvetFonts registry. HasAsset tells the caller whether a Font Asset was found; ResidualBold / ResidualItalic are the parts of the request that the chosen asset does NOT already satisfy and therefore must be emulated through -unity-font-style (faux bold / faux italic).

StateUpdater<T>

The single state setter returned by UseState<T>(T). Accepts either a replacement value (setValue(next)) or a functional updater (setValue(prev => next)). The functional form always reads the latest committed value, so it is safe to invoke from a closure captured by an earlier render (no stale-closure pitfall).

StylePropertyTransition

A single property's transition override inside PropertyOverrides. Any null field falls back to the enclosing config's corresponding top-level value — Easing falls back to the config's EFFECTIVE easing for the direction being played (Easing for an enter, ExitEasing ?? Easing for an exit), matching how the top-level fields already resolve per direction.

StyleSlotClasses

Read-only wrapper from slot name → class name.

TransitionStarter

The startTransition function returned by UseTransition(). Accepts either a synchronous callback (startTransition(() => ...)) or an async one (startTransition(async () => ...)). State updates inside the callback are scheduled on the Transition lane; for the async form, isPending stays true across awaits until the task completes. Nested calls join the outer transition.

Unit

A type with a single value. Used in generic positions that stand in for "no value" (e.g. MutationResult<TVariables, TData> with no variables or no return value).

Interfaces

IHookServiceResolver

Resolver abstraction that fetches services from the host DI container. Decouples DI-framework-specific implementations (such as VContainer) from the framework core.

IRouteScope

DI container abstraction for a route scope. Resolves services on a per-route basis; the scope is destroyed by Dispose when navigation leaves the route.

IRouteScopeFactory

Factory abstraction that builds route scopes. Decouples DI-framework-specific implementations (such as VContainer) from the framework core.

ISearchParams

Read-only view over URL query parameters that preserves every value of a repeated key.

IStoreWriter<TState>

Minimal write-side interface exposing a store's state-update API to collaborators. Store<TState> implements it explicitly.

Enums

AnimatePresenceMode

How an AnimatePresenceNode sequences exit and enter when its keyed children change.

FiberUpdatePriority

Lane priority for a scheduled re-render. The lane is chosen from the scheduling context, not passed as an argument: StartTransition updates and UseDeferredValue derivations take the Transition lane, a starved Transition lane is promoted to Deferred, and every other state update takes the Normal lane. Lower numeric values indicate higher priority; a fiber's lane queue drains lowest-value-first.

LoaderMode

Execution mode for a route loader.

MutationStatus

Lifecycle status of a mutation.

NavigationLifecycle

Lifecycle phase of the active navigation, as reported by UseNavigation().State.

NavigationMode

Navigation mode that determines how entries are pushed onto the history stack.

NavigationResult

Outcome of a navigation attempt.

PlayTrigger

When a Particles element starts its effect.

RouteBlockerStatus

Current state of a Blocker.

RouterStatus

Current processing state of the router.

StyleVariantKind

State-variant kinds for utility classes — the hover: / focus: / active: prefixes.

TransitionType

Selects the animation model a StyleTransitionConfig plays with — see Type.

TransitionWhen

Sequences a Motion's own class swap against its inheriting descendants' swaps — see When and StaggerChildrenSec.

UILayer

Framework-managed screen-space layer panels a Portal(UILayer, VNode?[]?, string?) can target, sorted around the app's main panel. Screen-space panels always composite over the 3D scene (the engine's compositor draws overlay panels after cameras) — UI that must sit among or behind scene geometry is WorldSpace(Vector3, Quaternion?, Vector2?, VNode?[]?, string?)'s depth-tested territory instead.

VelvetFontWeight

The numeric font-weight scale (font-thinfont-black). The underlying integer value is the CSS weight, so a class such as font-semibold resolves to (int)VelvetFontWeight.SemiBold == 600.

UI Toolkit's -unity-font-style can only express the binary normal/bold axis, so a weight only renders faithfully when a weight-specific Font Asset is registered for it in a VelvetFontFamily. When no such asset exists Velvet folds the weight to the nearest binary value (>= 600 → bold, otherwise normal); see VelvetFonts.