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
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
| Name | Description |
|---|---|
| StepsSlider | Initializes a new instance of the StepsSlider{T} class. |
Properties
| Name | Description |
|---|---|
| Value | Gets or sets the current value. |
| IsEnabled | Gets or sets whether the slider is enabled. |
| Orientation | Gets or sets the orientation of the slider. |
public bool IsEnabled { get ; set ; }Gets or sets whether the slider is enabled.
Methods
| Name | Description |
|---|---|
| Comparer | Sets the equality comparer for the steps. |
| SetValue | Sets the value of the slider. |
| OnChange | Attaches a handler to the change event. |
| Disabled | Sets whether the slider is disabled. |
| Horizontal | Sets the orientation to horizontal. |
| Vertical | Sets the orientation to vertical. |
| Render | Renders the component. |
public StepsSlider<T> Comparer(IEqualityComparer<T> equalityComparer)Sets the equality comparer for the steps.
Parameters
- equalityComparer
- The equality comparer.
Returns
The current instance.
public StepsSlider<T> SetValue(T val)Sets the value of the slider.
Parameters
- val
- The value.
Returns
The current instance.
public StepsSlider<T> OnChange(Action<T> onChange)Attaches a handler to the change event.
Parameters
- onChange
- The handler.
Returns
The current instance.
public StepsSlider<T> Disabled(bool value = true)Sets whether the slider is disabled.
Parameters
- value
- Whether it's disabled.
Returns
The current instance.