Skip to main content

Class FloatFieldSlider

A UI Toolkit Slider that includes an editable text field displaying the current float value. Dragging the slider updates the field; typing a new value into the field updates the slider.

public class FloatFieldSlider : Slider

Inheritance​

object→CallbackEventHandler→Focusable→VisualElement→BindableElement→BaseField<float>→BaseSlider<float>→Slider→FloatFieldSlider

Examples​

// In UXML:
//

// In C#:
var slider = new FloatFieldSlider(0f, 100f);
slider.value = 42f;
rootVisualElement.Add(slider);

Remarks​

Use this element in UXML in place of a plain Slider wherever the user also needs to enter a precise numeric value. The text field is appended inside the slider's input area and shares the same USS class hierarchy for consistent styling.

Constructors​

FloatFieldSlider()​

Initializes a new FloatFieldSlider with default range and orientation.

public FloatFieldSlider()

FloatFieldSlider(float, float, SliderDirection, float)​

Initializes a new FloatFieldSlider with the specified range and orientation.

public FloatFieldSlider(float start, float end, SliderDirection direction = SliderDirection.Horizontal, float pageSize = 0)

Parameters​

NameTypeDescription
startfloatThe minimum value of the slider.
endfloatThe maximum value of the slider.
directionSliderDirectionThe slider orientation (horizontal or vertical).
pageSizefloatThe page-size increment used when clicking the track.

Methods​

SetValueWithoutNotify(float)​

Sets the slider value without firing a change notification, and synchronises the text field display.

public override void SetValueWithoutNotify(float newValue)

Parameters​

NameTypeDescription
newValuefloatThe new float value to display.