Table of Contents

Method ScrollView

Namespace
Velvet
Assembly
Velvet.Docs.dll

ScrollView(string?, string?, string?, ScrollerVisibility?, ScrollerVisibility?, TouchScrollBehavior?, Action<VisualElement>?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)

Creates a ScrollView. Long form: every prop is a named optional parameter. For the shorthand V.ScrollView("class", child1, child2) form, see the params overload.

public static ElementNode ScrollView(string? className = null, string? key = null, string? name = null, ScrollerVisibility? verticalScrollerVisibility = null, ScrollerVisibility? horizontalScrollerVisibility = null, ScrollView.TouchScrollBehavior? touchScrollBehavior = null, Action<VisualElement>? onCreated = 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)

Parameters

className string

CSS-like utility class string. Multiple classes separated by spaces.

key string

Key used to disambiguate siblings at the same position.

name string

Element name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.

verticalScrollerVisibility ScrollerVisibility?

Visibility policy for the vertical scroller.

horizontalScrollerVisibility ScrollerVisibility?

Visibility policy for the horizontal scroller.

touchScrollBehavior ScrollView.TouchScrollBehavior?

Touch scroll behavior (Clamped / Elastic / Unrestricted).

onCreated Action<VisualElement>

Callback invoked once when the ScrollView VisualElement is first created.

refCallback Func<VisualElement, Action>

Callback invoked on mount with the created VisualElement; returned Action runs on unmount.

children VNode[]

Child VNodes placed inside the scroll content container.

whileHoverClass string

USS class toggled while the pointer hovers the element.

whileTapClass string

USS class toggled while the pointer is pressed on the element.

whileFocusClass string

USS class toggled while the element holds keyboard/UI focus.

data IReadOnlyDictionary<string, string>

data-* attribute map matched by data-[...] variants.

aria IReadOnlyDictionary<string, string>

aria-* attribute map matched by aria-[...] variants.

Returns

ElementNode

The created ElementNode representing the ScrollView.

ScrollView(string, params VNode?[])

Shorthand overload: positional className + variadic children, building a ScrollView element with just a class string and children. For any prop besides className, use the long-form overload with named arguments.

public static ElementNode ScrollView(string className, params VNode?[] children)

Parameters

className string

CSS-like utility class string. Multiple classes separated by spaces.

children VNode[]

Child VNodes; pass zero or more positionals or expand an existing array.

Returns

ElementNode

The created ElementNode.