Slider

Description

The Slider component represents a range input control that allows users to select a numeric value within a specific range. It is ideal for cases where a user needs to adjust a value by moving a handle along a track. This component is part of the Tesserae UI component library and falls under the Components group.

Usage

To instantiate a Slider, use the static helper method from the Tesserae.UI class. You can configure its initial value, minimum value, maximum value, and step interval. The component supports both horizontal and vertical orientations and provides methods to enable or disable the slider.

Below is a simple code example that demonstrates how to create and use a Slider instance:

API reference

class

Slider

public sealed class Slider : ComponentBase<Slider, HTMLInputElement>

A slider component.

Namespace
Tesserae
Inheritance
ComponentBase<Slider, HTMLInputElement> → Slider

Constructors

NameDescription
SliderInitializes a new instance of the Slider class.
Constructor
Slider
public Slider(int val = 0, int min = 0, int max = 100, int step = 10)

Initializes a new instance of the Slider class.

Parameters

val
The initial value.
min
The minimum value.
max
The maximum value.
step
The step size.

Properties

NameDescription
OrientationGets or sets the orientation of the slider.
ValueGets or sets the current value.
MinGets or sets the minimum value.
MaxGets or sets the maximum value.
StepGets or sets the step size.
IsEnabledGets or sets whether the slider is enabled.
Property
Slider.Orientation
public SliderOrientation Orientation { get ; set ; }

Gets or sets the orientation of the slider.

Property
Slider.Value
public int Value { get ; set ; }

Gets or sets the current value.

Property
Slider.Min
public int Min { get ; set ; }

Gets or sets the minimum value.

Property
Slider.Max
public int Max { get ; set ; }

Gets or sets the maximum value.

Property
Slider.Step
public int Step { get ; set ; }

Gets or sets the step size.

Property
Slider.IsEnabled
public bool IsEnabled { get ; set ; }

Gets or sets whether the slider is enabled.

Methods

NameDescription
RenderRenders the component.
SetValueSets the value of the slider.
SetMinSets the minimum value of the slider.
SetMaxSets the maximum value of the slider.
SetStepSets the step size of the slider.
DisabledSets whether the slider is disabled.
HorizontalSets the orientation to horizontal.
VerticalSets the orientation to vertical.
Method
Slider.Render
public override HTMLElement Render()

Renders the component.

Returns

The rendered HTML element.

Method
Slider.SetValue
public Slider SetValue(int val)

Sets the value of the slider.

Parameters

val
The value.

Returns

The current instance.

Method
Slider.SetMin
public Slider SetMin(int min)

Sets the minimum value of the slider.

Parameters

min
The minimum value.

Returns

The current instance.

Method
Slider.SetMax
public Slider SetMax(int max)

Sets the maximum value of the slider.

Parameters

max
The maximum value.

Returns

The current instance.

Method
Slider.SetStep
public Slider SetStep(int step)

Sets the step size of the slider.

Parameters

step
The step size.

Returns

The current instance.

Method
Slider.Disabled
public Slider Disabled(bool value = true)

Sets whether the slider is disabled.

Parameters

value
Whether it's disabled.

Returns

The current instance.

Method
Slider.Horizontal
public Slider Horizontal()

Sets the orientation to horizontal.

Returns

The current instance.

Method
Slider.Vertical
public Slider Vertical()

Sets the orientation to vertical.

Returns

The current instance.

Samples

Basic Slider Usage

This sample demonstrates how to create a basic horizontal slider configured with a minimum value of 0, a maximum value of 100, a default value of 0, and a step value of 1. The sample also shows how to attach an input event to handle user interactions.

Vertical Slider with Custom Range

This sample demonstrates setting up a vertical slider along with custom minimum, maximum, and step values. The slider orientation is changed to vertical using the Vertical() method.

See also

© 2026 Curiosity. All rights reserved.