Table of Contents

Method Slider

Namespace
Velvet
Assembly
Velvet.Docs.dll

Slider(string?, float?, float?, float?, Action<float>?, string?, string?, bool?, Func<VisualElement, Action>?, Action<VisualElement>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, SliderDirection?, bool?, float?, FiberEventBinding[]?)

Creates a Slider.

public static ElementNode Slider(string? className = null, float? value = null, float? lowValue = null, float? highValue = null, Action<float>? onValueChanged = null, string? key = null, string? name = null, bool? enabled = null, Func<VisualElement, Action>? refCallback = null, Action<VisualElement>? onCreated = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null, SliderDirection? direction = null, bool? inverted = null, float? step = null, FiberEventBinding[]? events = null)

Parameters

className string

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

value float?

Current slider value (controlled).

lowValue float?

Minimum value of the slider range.

highValue float?

Maximum value of the slider range.

onValueChanged Action<float>

Handler invoked when the slider value changes.

key string

Key used to disambiguate siblings at the same position.

name string

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

enabled bool?

When false, disables the slider input.

refCallback Func<VisualElement, Action>

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

onCreated Action<VisualElement>

Callback invoked once when the Slider VisualElement is first created.

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.

direction SliderDirection?

Axis the slider runs along, written to Slider.direction. Null leaves it undeclared rather than horizontal: a direction no render has declared is not written, and one a later render drops goes back to what the element carried before any render declared it.

inverted bool?

When true, swaps the ends the low and high values sit at, written to Slider.inverted. Null is undeclared, as for direction.

step float?

Distance one arrow key moves the value, and the grid Home, End and the paging keys land on, counted from lowValue. Null is Radix's default of 1.

events FiberEventBinding[]

Event bindings applied to the element, bound after onValueChanged's own (Documentation~/react-migration.md owns the rule). The array is read and never written.

Returns

ElementNode

The created ElementNode representing this slider.

Exceptions

ArgumentOutOfRangeException

direction names no member of UnityEngine.UIElements.SliderDirection, or step is not above zero and finite.