Method Image
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Image(string?, string?, string?, StyleOverrides?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)
Creates an Image element for displaying sprites or textures.
public static ElementNode Image(string? className = null, string? key = null, string? name = null, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null)
Parameters
classNamestringCSS-like utility class string. Multiple classes separated by spaces.
keystringKey used to disambiguate siblings at the same position.
namestringElement name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.
stylesStyleOverridesInline style overrides applied on top of USS classes (sprite / image typically set here).
refCallbackFunc<VisualElement, Action>Callback invoked on mount with the created VisualElement; returned Action runs on unmount.
whileHoverClassstringUSS class toggled while the pointer hovers the element (gesture-driven).
whileTapClassstringUSS class toggled while the pointer is pressed on the element (gesture-driven).
whileFocusClassstringUSS class toggled while the element holds keyboard/UI focus (gesture-driven).
dataIReadOnlyDictionary<string, string>data-* attribute map matched by
data-[...]variants.ariaIReadOnlyDictionary<string, string>aria-* attribute map matched by
aria-[...]variants.
Returns
- ElementNode
The created ElementNode representing this image.