PromptPlus

PromptPlus # PromptPlus ## **Slider — Operations** [![NuGet](https://img.shields.io/badge/NuGet-PromptPlus-blue)](https://www.nuget.org/packages/PromptPlus) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![.NET](https://img.shields.io/badge/.NET-8%20%7C%209%20%7C%2010-512BD4)](https://dotnet.microsoft.com/)

← Back to HomeNext: Slider — Styles →


How the Slider control behaves while it is running: keyboard, how the value steps, ranges and precision, colors and gradients, layout, history, and the details that matter in real apps.


Anatomy of the control

Select value 65                          ← prompt + live answer (same line)
Current selection: 65 %                  ← description (optional / dynamic)
0 [██████████████░░░░░░░░] 100           ← range · bar (LeftRight layout)
Left/Right: change  Enter: confirm  Esc  ← tooltip (toggle with F1 / Ctrl+F1)

Every region can be recolored — see Styles.


Keyboard

The keys that change the value depend on the Layout.

LeftRight layout (default — horizontal bar)

Key Action
/ Decrease / increase by one Step
Shift+Tab / Tab Decrease / increase by one LargeStep

UpDown layout (vertical, no bar)

Key Action
/ Decrease / increase by one Step
Shift+Tab / Tab Decrease / increase by one LargeStep

Actions (both layouts)

Key Action
Enter Confirm — returns the current value
Esc Abort (when the abort key is enabled) → IsAborted == true, Content == null
F1 Cycle tooltip content
Ctrl+F1 Show / hide the tooltip

⚠️ There is no Home/End-to-min/max binding, and Page Up/Page Down do not trigger the large step — Tab/Shift+Tab do. There is also no F3 interactive history list like Input/Secret have; EnableHistory on Slider is passive — it only pre-loads the last confirmed value as the next run’s Default, nothing more.


How the value steps

💡 Choose a Step that is a meaningful increment for your domain — for example 5 for a percentage picked in fives — so keyboard navigation feels natural.


Colors & gradients

Two independent ways to color the bar:

Both react as the value changes. Use one or the other per control.


Layout differences

Layout(SliderLayout.UpDown) is more than a rotation:

The default LeftRight layout shows the full bar and uses the Left / Right arrows.


History

When EnableHistory(filename, …) is set:

Unlike Input/Secret, Slider has no interactive history list — there’s no F3 hotkey and no Pagination/Selected/UnSelected history browsing UI. History here is purely passive: it just remembers the last confirmed value for next time.

You can also manage a history store directly with PromptPlus.Controls.History(filename) — add, save, or remove entries programmatically (used in the samples to seed reproducible data).


Options that change behavior

Set per instance via Options(...), or globally on PromptPlus.Config:

Option Effect on Slider
EnabledAbortKey(false) Removes Esc — the user must confirm
HideAfterFinish(true) Erases the bar after confirm — the whole control is erased, not just the interactive part
HideOnAbort(true) Erases the bar after Esc
ShowTooltip(false) Hides the keyboard hint line
Description(...) Overrides the description text

The global PromptPlus.Config.SliderWidth sets the default bar width; override it per control with Width.


Edge cases & gotchas


See also