SliderWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A slider widget for selecting numeric values within a range.
public sealed record SliderWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<SliderWidget>Inheritance
Object → Hex1bWidget → SliderWidget
Implements
Properties
InitialValue
The initial value when the slider is first created.
Returns: Double
public double InitialValue { get; init; }LargeStepPercent
The large step increment for PageUp/PageDown navigation, as a percentage of the range.
Returns: Double
public double LargeStepPercent { get; init; }Maximum
The maximum value of the slider range.
Returns: Double
public double Maximum { get; init; }Minimum
The minimum value of the slider range.
Returns: Double
public double Minimum { get; init; }Step
The step increment for keyboard navigation.
Returns: Nullable<Double>
public double? Step { get; init; }Methods
OnValueChanged(Action<SliderValueChangedEventArgs>)
Sets a synchronous handler called when the value changes. This is called for all input types: keyboard, click, drag, and scroll wheel.
Parameters:
handler(Action<SliderValueChangedEventArgs>): The handler to invoke on value change.
Returns: SliderWidget
A new SliderWidget with the handler configured.
public SliderWidget OnValueChanged(Action<SliderValueChangedEventArgs> handler)OnValueChanged(Func<SliderValueChangedEventArgs, Task>)
Sets an asynchronous handler called when the value changes. This is called for all input types: keyboard, click, drag, and scroll wheel.
Parameters:
handler(Func<SliderValueChangedEventArgs, Task>): The async handler to invoke on value change.
Returns: SliderWidget
A new SliderWidget with the handler configured.
public SliderWidget OnValueChanged(Func<SliderValueChangedEventArgs, Task> handler)Fields
DecreaseLargeActionId
Action ID for decreasing the slider value by a large step.
Returns: ActionId
public static readonly ActionId DecreaseLargeActionIdDecreaseSmallActionId
Action ID for decreasing the slider value by a small step.
Returns: ActionId
public static readonly ActionId DecreaseSmallActionIdIncreaseLargeActionId
Action ID for increasing the slider value by a large step.
Returns: ActionId
public static readonly ActionId IncreaseLargeActionIdIncreaseSmallActionId
Action ID for increasing the slider value by a small step.
Returns: ActionId
public static readonly ActionId IncreaseSmallActionIdJumpToMaximumActionId
Action ID for jumping to the maximum value.
Returns: ActionId
public static readonly ActionId JumpToMaximumActionIdJumpToMinimumActionId
Action ID for jumping to the minimum value.
Returns: ActionId
public static readonly ActionId JumpToMinimumActionIdSetValueActionId
Action ID for setting the slider value via mouse click.
Returns: ActionId
public static readonly ActionId SetValueActionIdRemarks
The slider displays a horizontal track with a movable handle. Users can adjust the value using keyboard controls or mouse clicks on the track.
Keyboard controls:
Left/Down arrow: Decrease value by stepRight/Up arrow: Increase value by stepHome: Jump to minimum valueEnd: Jump to maximum valuePageUp: Increase by large step (10% of range)PageDown: Decrease by large step (10% of range)
The slider state (current value) is owned by the node and preserved across re-renders. Use to set the starting value when the slider is first created.
Examples
Simple slider (0-100):
ctx.Slider(50)
.OnValueChanged(e => Console.WriteLine($"Value: {e.Value}"));Custom range with step:
ctx.Slider(initialValue: 25, min: 0, max: 100, step: 5)