StepsSlider

Description

A slider that snaps to discrete named steps

StepsSlider is a generic slider component that constrains movement to a fixed set of named values. Unlike a continuous slider, it only ever lands on one of the provided steps, making it suitable for cases where only a handful of distinct choices are valid.

Common uses include selecting T-shirt sizes, quality levels, priority tiers, or any domain-specific ordered category where a free numeric value would be meaningless.

API reference

class

StepsSlider<T>

public sealed class StepsSlider<T> : IComponent where T : IEquatable<T>

A slider component that snaps to discrete steps.

Type Parameters

T
The type of the steps.
Namespace
Tesserae
Implements
IComponent

Constructors

NameDescription
StepsSliderInitializes a new instance of the StepsSlider{T} class.
Constructor
StepsSlider
public StepsSlider(params T[] steps)

Initializes a new instance of the StepsSlider{T} class.

Parameters

steps
The discrete steps.

Properties

NameDescription
ValueGets or sets the current value.
IsEnabledGets or sets whether the slider is enabled.
OrientationGets or sets the orientation of the slider.
Property
StepsSlider.Value
public T Value { get ; set ; }

Gets or sets the current value.

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

Gets or sets whether the slider is enabled.

Property
StepsSlider.Orientation
public Slider.SliderOrientation Orientation { get ; set ; }

Gets or sets the orientation of the slider.

Methods

NameDescription
ComparerSets the equality comparer for the steps.
SetValueSets the value of the slider.
OnChangeAttaches a handler to the change event.
DisabledSets whether the slider is disabled.
HorizontalSets the orientation to horizontal.
VerticalSets the orientation to vertical.
RenderRenders the component.
Method
StepsSlider.Comparer
public StepsSlider<T> Comparer(IEqualityComparer<T> equalityComparer)

Sets the equality comparer for the steps.

Parameters

equalityComparer
The equality comparer.

Returns

The current instance.

Method
StepsSlider.SetValue
public StepsSlider<T> SetValue(T val)

Sets the value of the slider.

Parameters

val
The value.

Returns

The current instance.

Method
StepsSlider.OnChange
public StepsSlider<T> OnChange(Action<T> onChange)

Attaches a handler to the change event.

Parameters

onChange
The handler.

Returns

The current instance.

Method
StepsSlider.Disabled
public StepsSlider<T> Disabled(bool value = true)

Sets whether the slider is disabled.

Parameters

value
Whether it's disabled.

Returns

The current instance.

Method
StepsSlider.Horizontal
public StepsSlider<T> Horizontal()

Sets the orientation to horizontal.

Method
StepsSlider.Vertical
public StepsSlider<T> Vertical()

Sets the orientation to vertical.

Method
StepsSlider.Render
public HTMLElement Render()

Renders the component.

Returns

The rendered HTML element.

Samples

String Steps (T-shirt Sizes)

Integer Steps (Percentage)

Disabled

See also

© 2026 Curiosity. All rights reserved.