Method Custom
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Custom<T>(string?, string?, string?, FiberElementProps?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, FiberEventBinding[]?)
Creates an element backed by a custom UnityEngine.UIElements.VisualElement subclass T,
for control types the built-in factories (Div(string?, string?, string?, FiberElementProps?, StyleOverrides?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, FiberEventBinding[]?), Label(string?, string?, string?, string?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, FiberEventBinding[]?), …) do not expose.
Long form: every prop is a named optional parameter. For the shorthand
V.Custom<T>("class", child1, child2) form, see the params overload.
public static ElementNode Custom<T>(string? className = null, string? key = null, string? name = null, FiberElementProps? props = null, Func<VisualElement, Action>? refCallback = null, VNode?[]? children = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null, FiberEventBinding[]? events = null) where T : VisualElement
Parameters
classNamestringCSS-like utility class string. Multiple classes separated by spaces. A text-input or popup field type takes its surface utilities on its input box, as TextField(string?, string?, Action<string>?, string?, string?, string?, bool?, bool?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, string?, int?, bool?, bool?, bool?, TouchScreenKeyboardType?, bool?, Action<string>?, EventCallback<KeyDownEvent>?, EventCallback<KeyUpEvent>?, EventCallback<FocusInEvent>?, EventCallback<FocusOutEvent>?, Action<VisualElement>?, FiberEventBinding[]?) does.
keystringKey used to disambiguate siblings at the same position.
namestringElement name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.
propsFiberElementPropsOptional FiberElementProps (text / tooltip / enabled / etc.) bag.
refCallbackFunc<VisualElement, Action>Callback invoked on mount with the created VisualElement; returned Action runs on unmount.
childrenVNode[]Child VNodes rendered inside this element.
whileHoverClassstringUSS class toggled while the pointer hovers the element.
whileTapClassstringUSS class toggled while the pointer is pressed on the element.
whileFocusClassstringUSS class toggled while the element holds keyboard/UI focus.
dataIReadOnlyDictionary<string, string>data-* attribute map matched by
data-[...]variants.ariaIReadOnlyDictionary<string, string>aria-* attribute map matched by
aria-[...]variants.eventsFiberEventBinding[]Event bindings applied to the element (
Documentation~/react-migration.mdowns the rule). The array is read and never written.
Returns
- ElementNode
The created ElementNode representing this element.
Type Parameters
TConcrete VisualElement subclass to instantiate.
Custom<T>(string, params VNode?[])
Shorthand overload: positional className + variadic
children, building a T element with just a class string and children.
For any prop besides className, use the long-form overload
with named arguments.
public static ElementNode Custom<T>(string className, params VNode?[] children) where T : VisualElement
Parameters
classNamestringCSS-like utility class string. Multiple classes separated by spaces.
childrenVNode[]Child VNodes; pass zero or more positionals or expand an existing array.
Returns
- ElementNode
The created ElementNode.
Type Parameters
TConcrete VisualElement subclass to instantiate.
Custom<T>(string, FiberEventBinding[], params VNode?[])
Shorthand overload with event bindings: positional className,
events and variadic children, building a T element.
public static ElementNode Custom<T>(string className, FiberEventBinding[] events, params VNode?[] children) where T : VisualElement
Parameters
classNamestringCSS-like utility class string. Multiple classes separated by spaces.
eventsFiberEventBinding[]Event bindings applied to the element (
Documentation~/react-migration.mdowns the rule). The array is read and never written.childrenVNode[]Child VNodes; pass zero or more positionals or expand an existing array.
Returns
- ElementNode
The created ElementNode.
Type Parameters
TConcrete VisualElement subclass to instantiate.