---
title: "Slider"
language: "en"
type: "Symbol"
summary: "Slider[x] represents a slider with setting x in the range 0 to 1. Slider[Dynamic[x]] takes the setting to be the dynamically updated current value of x, with the value of x being reset if the slider is moved. Slider[x, {xmin, xmax}] represents a slider with range xmin to xmax. Slider[x, {xmin, xmax, dx}] represents a slider that jumps in steps dx. Slider[x, {{e1, e2, ...}}] represents a slider in which equally spaced intervals correspond to successive settings ei. Slider[x, {{{e1, w1}, {e2, w2}, ...}}] uses intervals of relative widths wi for the ei."
keywords: 
- scrollbar
- slider
- Slider
canonical_url: "https://reference.wolfram.com/language/ref/Slider.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Control Objects"
    link: "https://reference.wolfram.com/language/guide/ControlObjects.en.md"
  - 
    title: "Form Structure & Layout"
    link: "https://reference.wolfram.com/language/guide/FormStructureAndLayout.en.md"
  - 
    title: "Options & Styling for Interactive Manipulation"
    link: "https://reference.wolfram.com/language/guide/OptionsAndStylingForInteractiveManipulation.en.md"
  - 
    title: "Dynamic Visualization"
    link: "https://reference.wolfram.com/language/guide/DynamicVisualization.en.md"
  - 
    title: "Creating Form Interfaces & Apps"
    link: "https://reference.wolfram.com/language/guide/CreatingFormsAndApps.en.md"
  - 
    title: "Dynamic Interactivity Language"
    link: "https://reference.wolfram.com/language/guide/DynamicInteractivityLanguage.en.md"
  - 
    title: "Interactive Manipulation"
    link: "https://reference.wolfram.com/language/guide/InteractiveManipulation.en.md"
  - 
    title: "Creating Inspectors"
    link: "https://reference.wolfram.com/language/guide/CreatingInspectors.en.md"
related_workflows: 
  - 
    title: "Make Forms with Sliders and Other Controls"
    link: "https://reference.wolfram.com/language/workflow/MakeFormsWithSlidersAndOtherControls.en.md"
  - 
    title: "Build a Manipulate"
    link: "https://reference.wolfram.com/language/workflow/BuildAManipulate.en.md"
related_functions: 
  - 
    title: "VerticalSlider"
    link: "https://reference.wolfram.com/language/ref/VerticalSlider.en.md"
  - 
    title: "IntervalSlider"
    link: "https://reference.wolfram.com/language/ref/IntervalSlider.en.md"
  - 
    title: "Manipulator"
    link: "https://reference.wolfram.com/language/ref/Manipulator.en.md"
  - 
    title: "ProgressIndicator"
    link: "https://reference.wolfram.com/language/ref/ProgressIndicator.en.md"
  - 
    title: "HorizontalGauge"
    link: "https://reference.wolfram.com/language/ref/HorizontalGauge.en.md"
  - 
    title: "Locator"
    link: "https://reference.wolfram.com/language/ref/Locator.en.md"
  - 
    title: "Animator"
    link: "https://reference.wolfram.com/language/ref/Animator.en.md"
  - 
    title: "Slider2D"
    link: "https://reference.wolfram.com/language/ref/Slider2D.en.md"
  - 
    title: "ColorSlider"
    link: "https://reference.wolfram.com/language/ref/ColorSlider.en.md"
  - 
    title: "Control"
    link: "https://reference.wolfram.com/language/ref/Control.en.md"
  - 
    title: "LocatorPane"
    link: "https://reference.wolfram.com/language/ref/LocatorPane.en.md"
  - 
    title: "ControlsRendering"
    link: "https://reference.wolfram.com/language/ref/ControlsRendering.en.md"
related_tutorials: 
  - 
    title: "Introduction to Dynamic"
    link: "https://reference.wolfram.com/language/tutorial/IntroductionToDynamic.en.md"
  - 
    title: "Introduction to Control Objects"
    link: "https://reference.wolfram.com/language/tutorial/IntroductionToControlObjects.en.md"
  - 
    title: "Generalized Input"
    link: "https://reference.wolfram.com/language/tutorial/GeneralizedInput.en.md"
---
# Slider

Slider[x] represents a slider with setting x in the range 0 to 1. 

Slider[Dynamic[x]] takes the setting to be the dynamically updated current value of x, with the value of x being reset if the slider is moved. 

Slider[x, {xmin, xmax}] represents a slider with range xmin to xmax. 

Slider[x, {xmin, xmax, dx}] represents a slider that jumps in steps dx. 

Slider[x, {{e1, e2, …}}] represents a slider in which equally spaced intervals correspond to successive settings ei. 

Slider[x, {{{e1, w1}, {e2, w2}, …}}] uses intervals of relative widths wi for the ei.

## Details and Options

* ``Slider[…]`` displays in a notebook as a horizontal slider that can be manipulated interactively.

* ``Slider[Dynamic[x]]`` will reset the value of ``x`` when the slider is moved; ``Slider[x]`` will not.

* ``Slider[n, {nmin, nmax, dn}]`` jumps to integer positions if ``nmin`` and ``dn`` are integers. »

* ``Slider[x, {xmin, xmax, dx}]`` in general jumps to positions given by ``Range[xmin, xmax, dx]``. »

* ``Slider[x]`` represents a slider running from left to right.

* ``Slider[x, {xmax, xmin}]`` with ``xmax`` > ``xmin`` represents a slider running from right to left. »

* If the value of the slider is outside the range given, it will be displayed at one of the ends.

* ``Slider[x, {0, 1, dx}]`` displays at position ``x``, even if this is not a multiple of ``dx``.

* In ``Slider[x, {{e1, e2, …}}]``, the ``ei`` can be any expressions, not just numbers. »

* The following options can be given:

|                   |           |                                                                     |
| :---------------- | :-------- | :------------------------------------------------------------------ |
| Appearance        | Automatic | the overall appearance of the slider                                |
| AutoAction        | False     | whether to move the slider automatically when the mouse is over it  |
| BaselinePosition  | Automatic | alignment relative to surrounding text                              |
| BaseStyle         | {}        | base style specifications for the slider                            |
| ContinuousAction  | True      | whether to update continuously when the slider is moved             |
| Enabled           | Automatic | whether the slider is enabled or grayed out                         |
| Exclusions        | {}        | specific values to be excluded                                      |
| ImageMargins      | 0         | margins around the image of the displayed slider                    |
| ImageSize         | Automatic | the overall image size of the displayed slider                      |

* Possible settings for ``Appearance`` include ``Tiny``, ``Small``, ``Medium``, and ``Large``, as well as typically some other settings such as ``"UpArrow"`` and ``"DownArrow"``.

* ``Appearance -> "Labeled"`` displays the current value of the slider as an editable label.

* The settings for ``BaseStyle`` are appended to the default style typically given by the ``"Slider"`` style in the current stylesheet.

* ``Slider[]`` is equivalent to ``Slider[0.5]``.

* The resulting slider can be finely manipulated by holding down the alt key (or opt on Macintosh) while dragging the mouse. This causes the slider to move at 1/20 the rate of the mouse. The slider can be even more finely manipulated by also holding the shift and/or ctrl keys.

---

## Examples (32)

### Basic Examples (3)

A slider set at $0.8$ in the default range $0$ to $1$ :

```wl
In[1]:= Slider[0.8]

Out[1]= Slider[0.8]
```

---

A slider with its value updated dynamically:

```wl
In[1]:= {Slider[Dynamic[x]], Dynamic[x]}

Out[1]= {Slider[Dynamic[x]], Dynamic[x]}
```

---

A slider with integer values in the range $0$ to $100$ :

```wl
In[1]:= {Slider[Dynamic[n], {0, 100, 1}], Dynamic[n]}

Out[1]= {Slider[Dynamic[n], {0, 100, 1}], Dynamic[n]}
```

### Scope (5)

Use the range $-1$ to $1$, increasing when going from left to right:

```wl
In[1]:= x = 0;{Slider[Dynamic[x], {-1, 1}], Dynamic[x]}

Out[1]= {Slider[Dynamic[x], {-1, 1}], Dynamic[x]}
```

A slider with range $1$ to $-1$, increasing when going from right to left:

```wl
In[2]:= y = 0;{Slider[Dynamic[y], {1, -1}], Dynamic[y]}

Out[2]= {Slider[Dynamic[y], {1, -1}], Dynamic[y]}
```

---

Use only integer variable values:

```wl
In[1]:= {Slider[Dynamic[n], {0, 100, 1}], Dynamic[n]}

Out[1]= {Slider[Dynamic[n], {0, 100, 1}], Dynamic[n]}
```

---

Use rational steps:

```wl
In[1]:= {Slider[Dynamic[x], {0, 1, 1 / 5}], Dynamic[x]}

Out[1]=
{Slider[Dynamic[BoxForm`RemapVariable[x, {0, 1, Rational[1, 5]}], 
  BoxForm`RemapValue[#1, x, {0, 1, Rational[1, 5]}] & ], {0, 5, 1}], Dynamic[x]}
```

Use slider increments of ``π`` :

```wl
In[2]:= {Slider[Dynamic[y], {0, 10Pi, Pi}], Dynamic[y]}

Out[2]=
{Slider[Dynamic[BoxForm`RemapVariable[y, {0, 10*Pi, Pi}], 
  BoxForm`RemapValue[#1, y, {0, 10*Pi, Pi}] & ], {0, 10, 1}], Dynamic[y]}
```

Use a symbolic range:

```wl
In[3]:= {Slider[Dynamic[z], {a, 20a, 2a}], Dynamic[z]}

Out[3]=
{Slider[Dynamic[BoxForm`RemapVariable[z, {a, 20*a, 
    2*a}], BoxForm`RemapValue[#1, z, {a, 20*a, 
     2*a}] & ], {0, 19/2, 1}], Dynamic[z]}
```

---

Use a list of possible values:

```wl
In[1]:= {Slider[Dynamic[x], {{a, 2, True}}], Dynamic[x]}

Out[1]= {Slider[Dynamic[x], {{a, 2, True}}], Dynamic[x]}
```

---

Change the relative width corresponding to each possible value:

```wl
In[1]:= {Slider[Dynamic[x], {{{a, 10}, {2, 5}, {True, 20}}}], Dynamic[x]}

Out[1]= {Slider[Dynamic[x], {{{a, 10}, {2, 5}, {True, 20}}}], Dynamic[x]}
```

### Options (20)

#### Appearance (4)

Different sizes:

```wl
In[1]:= Table[Slider[0.5, Appearance -> a], {a, {Tiny, Small, Medium, Large}}]

Out[1]= {Slider[0.5, Appearance -> Tiny], Slider[0.5, Appearance -> Small], Slider[0.5, Appearance -> Medium], Slider[0.5, Appearance -> Large]}
```

---

Add a label:

```wl
In[1]:= Slider[0.5, Appearance -> "Labeled"]

Out[1]= DynamicModule[«3»]
```

---

Special arrow appearances are available on some platforms:

```wl
In[1]:= Table[Slider[0.5, Appearance -> a], {a, {"UpArrow", "DownArrow"}}]

Out[1]= {Slider[0.5, Appearance -> "UpArrow"], Slider[0.5, Appearance -> "DownArrow"]}
```

---

Use dynamic appearance, based on whether ``Round[x]`` is $0$ or $1$ :

```wl
In[1]:= {Slider[Dynamic[x], Appearance -> Dynamic[If[Round[x] == 1, "UpArrow", "DownArrow"]]], Dynamic[Round[x]]}

Out[1]=
{Slider[Dynamic[x], Appearance -> Dynamic[If[Round[x] == 1, "UpArrow", 
    "DownArrow"]]], Dynamic[Round[x]]}
```

#### AutoAction (2)

By default, no slider values change until you click in the slider area:

```wl
In[1]:= {Slider[Dynamic[x]], Dynamic[x]}

Out[1]= {Slider[Dynamic[x]], Dynamic[x]}
```

---

By setting ``AutoAction``, the slider values change as the mouse moves over the slider area:

```wl
In[1]:= {Slider[Dynamic[x], AutoAction -> True], Dynamic[x]}

Out[1]= {Slider[Dynamic[x], AutoAction -> True], Dynamic[x]}
```

#### Background (2)

Change the background colors:

```wl
In[1]:= Table[Slider[0.5, Background -> c], {c, {Pink, Green, Gray, Yellow}}]

Out[1]= {Slider[0.5, Background -> RGBColor[1, 0.5, 0.5]], Slider[0.5, Background -> RGBColor[0, 1, 0]], Slider[0.5, Background -> GrayLevel[0.5]], Slider[0.5, Background -> RGBColor[1, 1, 0]]}
```

---

Change the background color dynamically:

```wl
In[1]:= Slider[Dynamic[x], Background -> Dynamic[Hue[x]]]

Out[1]= Slider[Dynamic[x], Background -> Dynamic[Hue[x]]]
```

#### BaselinePosition (2)

Align with the surrounding text:

```wl
In[1]:= Row[Table[Slider[0.5, ImageSize -> 100, BaselinePosition -> p], {p, {Top, Center, Bottom}}], "xxx"]

Out[1]=
Row[{Slider[0.5, ImageSize -> 100, BaselinePosition -> Top], 
  Slider[0.5, ImageSize -> 100, BaselinePosition -> Center], 
  Slider[0.5, ImageSize -> 100, BaselinePosition -> Bottom]}, "xxx"]
```

---

Dynamically change the baseline position:

```wl
In[1]:= {"x", Slider[Dynamic[x], {{Top, Center, Bottom}}, BaselinePosition -> Dynamic[x]], "x"}//Row

Out[1]= Row[{"x", Slider[Dynamic[x], {{Top, Center, Bottom}}, BaselinePosition -> Dynamic[x]], "x"}]
```

#### ContinuousAction (2)

By default, variables are continuously updated:

```wl
In[1]:= {Slider[Dynamic[x]], Dynamic[x]}

Out[1]= {Slider[Dynamic[x]], Dynamic[x]}
```

---

Setting ``ContinuousAction`` to ``False`` makes variables update only when the slider is released:

```wl
In[1]:= {Slider[Dynamic[y], ContinuousAction -> False], Dynamic[y]}

Out[1]= {Slider[Dynamic[y], ContinuousAction -> False], Dynamic[y]}
```

#### Enabled (2)

By default, ``Slider`` is enabled:

```wl
In[1]:= Slider[0.5]

Out[1]= Slider[0.658]
```

---

By setting ``Enabled -> False``, the slider is disabled but visible in its current state:

```wl
In[1]:= Slider[0.3, Enabled -> False]

Out[1]= Slider[0.3, Enabled -> False]
```

#### Exclusions (1)

Exclude values from the range:

```wl
In[1]:= {Slider[Dynamic[x], {0, 1, 0.2}, Exclusions -> {0.4, 0.8}], Dynamic[x]}

Out[1]= {Slider[Dynamic[x], {0, 1, 0.2}, Exclusions -> {0.4, 0.8}], Dynamic[x]}
```

#### ImageMargins (1)

By setting ``ImageMargins``, you make the slider area larger:

```wl
In[1]:= Table[Slider[0.5, ImageMargins -> m, Background -> Pink], {m, {0, 5, 10, 20}}]

Out[1]= {Slider[0.5, Background -> RGBColor[1, 0.5, 0.5], ImageMargins -> 0], Slider[0.46900000000000003, Background -> RGBColor[1, 0.5, 0.5], ImageMargins -> 5], Slider[0.5, Background -> RGBColor[1, 0.5, 0.5], ImageMargins -> 10], Slider[0.5, Background -> RGBColor[1, 0.5, 0.5], ImageMargins -> 20]}
```

#### ImageSize (4)

Use preset values:

```wl
In[1]:= Column[Table[Slider[0.5, ImageSize -> i], {i, {Tiny, Small, Medium, Large}}]]

Out[1]=
Slider[0.5, ImageSize -> Tiny]
Slider[0.5, ImageSize -> Small]
Slider[0.5, ImageSize -> Medium]
Slider[0.5, ImageSize -> Large]
```

---

Or use any values:

```wl
In[1]:= Column[Table[Slider[0.5, ImageSize -> i], {i, {50, 150, 300, 500}}]]

Out[1]=
Slider[0.5, ImageSize -> 50]
Slider[0.5, ImageSize -> 150]
Slider[0.5, ImageSize -> 300]
Slider[0.5, ImageSize -> 500]
```

---

By setting the second element, you can also control the height reserved by the slider:

```wl
In[1]:= Slider[0.5, ImageSize -> {Automatic, 50}]

Out[1]= Slider[0.5, ImageSize -> {Automatic, 50}]
```

---

A fully custom image size:

```wl
In[1]:= Slider[0.5, ImageSize -> {50, 50}]

Out[1]= Slider[0.5700000000000001, ImageSize -> {50, 50}]
```

### Applications (2)

Selecting the ``n``$$^{\text{th}}$$ prime:

```wl
In[1]:= DynamicModule[{n = 1000}, {Slider[Dynamic[n], {1, 10^5, 1}], Subscript[p, Dynamic[n]]⟶Dynamic[Prime[n]]}]

Out[1]= DynamicModule[«3»]
```

Selecting the ``n``$$^{\text{th}}$$ digit in the decimal expansion of ``π`` :

```wl
In[2]:= DynamicModule[{n = 10000}, {Slider[Dynamic[n], {1, 10^5, 1}], Subscript[π, Dynamic[n]]⟶Dynamic[First@First@RealDigits[Pi, 10, 1, -n]]}]

Out[2]= DynamicModule[«3»]
```

---

A color selector:

```wl
In[1]:=
DynamicModule[{red = 0, green = 0, blue = 0}, 
	Column[{Grid[{
	{Graphics[{Red, Rectangle[]}, ImageSize -> 30], Slider[Dynamic[red]]}, {Graphics[{Green, Rectangle[]}, ImageSize -> 30], Slider[Dynamic[green]]}, 
	{Graphics[{Blue, Rectangle[]}, ImageSize -> 30], Slider[Dynamic[blue]]}}], 
	Dynamic[Graphics[{RGBColor[Dynamic[red], Dynamic[green], Dynamic[blue]], Disk[]}]]}]]

Out[1]= DynamicModule[«3»]
```

### Possible Issues (1)

Appearances provided by the operating system may be different or unavailable on other platforms:

```wl
In[1]:= Slider[0.5, Appearance -> "UpArrow"]

Out[1]= Slider[0.5, Appearance -> "UpArrow"]
```

Generic appearances are available on all platforms:

```wl
In[2]:= Style[Slider[0.5, Appearance -> "UpArrow"], ControlsRendering -> "Generic"]

Out[2]= Slider[0.5, Appearance -> "UpArrow"]
```

### Neat Examples (1)

Randomly sized sliders:

```wl
In[1]:= DynamicModule[{x = RandomReal[]}, Column[Table[Slider[Dynamic[x], ImageSize -> RandomReal[200]], {10}]]]

Out[1]= DynamicModule[«3»]
```

## See Also

* [`VerticalSlider`](https://reference.wolfram.com/language/ref/VerticalSlider.en.md)
* [`IntervalSlider`](https://reference.wolfram.com/language/ref/IntervalSlider.en.md)
* [`Manipulator`](https://reference.wolfram.com/language/ref/Manipulator.en.md)
* [`ProgressIndicator`](https://reference.wolfram.com/language/ref/ProgressIndicator.en.md)
* [`HorizontalGauge`](https://reference.wolfram.com/language/ref/HorizontalGauge.en.md)
* [`Locator`](https://reference.wolfram.com/language/ref/Locator.en.md)
* [`Animator`](https://reference.wolfram.com/language/ref/Animator.en.md)
* [`Slider2D`](https://reference.wolfram.com/language/ref/Slider2D.en.md)
* [`ColorSlider`](https://reference.wolfram.com/language/ref/ColorSlider.en.md)
* [`Control`](https://reference.wolfram.com/language/ref/Control.en.md)
* [`LocatorPane`](https://reference.wolfram.com/language/ref/LocatorPane.en.md)
* [`ControlsRendering`](https://reference.wolfram.com/language/ref/ControlsRendering.en.md)

## Tech Notes

* [Introduction to Dynamic](https://reference.wolfram.com/language/tutorial/IntroductionToDynamic.en.md)
* [Introduction to Control Objects](https://reference.wolfram.com/language/tutorial/IntroductionToControlObjects.en.md)
* [Generalized Input](https://reference.wolfram.com/language/tutorial/GeneralizedInput.en.md)

## Related Guides

* [Control Objects](https://reference.wolfram.com/language/guide/ControlObjects.en.md)
* [Form Structure & Layout](https://reference.wolfram.com/language/guide/FormStructureAndLayout.en.md)
* [Options & Styling for Interactive Manipulation](https://reference.wolfram.com/language/guide/OptionsAndStylingForInteractiveManipulation.en.md)
* [Dynamic Visualization](https://reference.wolfram.com/language/guide/DynamicVisualization.en.md)
* [Creating Form Interfaces & Apps](https://reference.wolfram.com/language/guide/CreatingFormsAndApps.en.md)
* [Dynamic Interactivity Language](https://reference.wolfram.com/language/guide/DynamicInteractivityLanguage.en.md)
* [Interactive Manipulation](https://reference.wolfram.com/language/guide/InteractiveManipulation.en.md)
* [Creating Inspectors](https://reference.wolfram.com/language/guide/CreatingInspectors.en.md)

## Related Workflows

* [Make Forms with Sliders and Other Controls](https://reference.wolfram.com/language/workflow/MakeFormsWithSlidersAndOtherControls.en.md)
* [Build a Manipulate](https://reference.wolfram.com/language/workflow/BuildAManipulate.en.md)

## Related Links

* [Fast Introduction for Programmers: Interactive Interfaces](http://www.wolfram.com/language/fast-introduction-for-programmers/interactive-interfaces/)

## History

* [Introduced in 2007 (6.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn60.en.md) \| [Updated in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md)