← Back to Home • Next: Slider — Methods →
Pick a numeric value by moving a bar between a minimum and a maximum. The user nudges the value with the arrow keys and confirms with Enter.
The Slider control is the natural way to collect a bounded number — volume, brightness, a
timeout in seconds, a priority, a percentage. Instead of typing digits, the user slides a visual
bar between the limits you define. It supports custom ranges, decimal precision, small and large
steps, per-value coloring, gradients, a vertical layout, and persistent history — all through a
single fluent chain.
📊 Just need to display a value without asking for input? Use the read-only Slider widget instead — it renders the same bar but does not wait for the user.
| Sub-page | What you will find |
|---|---|
| Index (this page) | What it is, when to use it, a first working example, the method map |
| Methods | Every fluent method — signature, parameters, defaults, and a snippet |
| Operations | Keyboard, stepping, ranges, gradients, history, and edge cases |
| Styles | The SliderStyles regions and how to recolor them |
Use Slider when… |
Consider instead… |
|---|---|
| You need a bounded numeric value chosen by feel | — |
| The user should pick from a short, discrete list | Select |
| You need free numeric entry, currency, or a fixed pattern | MaskEdit family |
| You only need to display a value, not collect one | Slider widget |
using PromptPlusLibrary;
var result = PromptPlus.Controls
.Slider("Select value")
.Run();
if (!result.IsAborted)
PromptPlus.Console.WriteLine($"Value: {result.Content}");
Slider("Select value") creates the control. The first argument is the prompt; an optional
second argument is a description line shown under it.0..Run() renders the bar and blocks until the user presses Enter (confirm) or Esc (abort).ResultPrompt<double?>: read .Content
for the value and .IsAborted to detect Esc.💡 The value is nullable. On abort
.Contentisnull— always checkIsAbortedfirst.
using PromptPlusLibrary;
var temperature = PromptPlus.Controls
.Slider("Target temperature", "Custom range -50..50")
.Range(-50, 50) // lower / upper limit
.FractionalDigits(1) // one decimal place
.Step(0.5) // arrow keys move by 0.5
.LargeStep(5) // Page Up / Page Down move by 5
.Default(0) // start centered
.Run();
if (!temperature.IsAborted)
PromptPlus.Console.WriteLine($"Temperature: {temperature.Content}");
This combines the four things you most often tune together: a custom range (Range),
precision (FractionalDigits), the small and large step sizes (Step, LargeStep), and a
starting value (Default). See Operations for how stepping behaves at runtime.
Grouped by purpose. Full signatures and examples are on the Methods page.
| Purpose | Methods |
|---|---|
| Range & precision | Range, Width, FractionalDigits, Culture |
| Starting value | Default |
| Step increments | Step, LargeStep |
| Bar appearance & layout | BarType, ChangeColor, ChangeGradient, HideElements, Layout |
| Dynamic description | ChangeDescription, ChangeDescriptionAsync |
| History | EnableHistory |
| Appearance & behavior | Styles, Options |
| Run | Run |
Slider returns ResultPrompt<double?>.
| Member | Meaning |
|---|---|
.Content |
The confirmed value (null if aborted) |
.IsAborted |
true when the user pressed Esc / the abort key |
var (value, aborted) = PromptPlus.Controls.Slider("Value").Run();
if (!aborted) PromptPlus.Console.WriteLine($"{value}");