({{, (RefLink[Slider, paclet:ref/Slider])[x]
represents a slider with setting x in the range 0 to 1. }, {, (RefLink[Slider, paclet:ref/Slider])[(RefLink[Dynamic, paclet:ref/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. }, {, (RefLink[Slider, paclet:ref/Slider])[x,{(Subscript[x, min]),(Subscript[x, max])}]
represents a slider with range (Subscript[x, min]) to (Subscript[x, max]). }, {, (RefLink[Slider, paclet:ref/Slider])[x,{(Subscript[x, min]),(Subscript[x, max]),dx}]
represents a slider that jumps in steps dx. }, {, (RefLink[Slider, paclet:ref/Slider])[x,{{(Subscript[e, 1]),(Subscript[e, 2]),…}}]
represents a slider in which equally spaced intervals correspond to successive settings (Subscript[e, i]). }, {, (RefLink[Slider, paclet:ref/Slider])[x,{{{(Subscript[e, 1]),(Subscript[w, 1])},{(Subscript[e, 2]),(Subscript[w, 2])},…}}]
uses intervals of relative widths (Subscript[w, i]) for the (Subscript[e, i]). }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[Slider, paclet:ref/Slider])[…] displays in a notebook as a horizontal slider that can be manipulated interactively.

(RefLink[Slider, paclet:ref/Slider])[(RefLink[Dynamic, paclet:ref/Dynamic])[x]] will reset the value of x when the slider is moved; (RefLink[Slider, paclet:ref/Slider])[x] will not.

(RefLink[Slider, paclet:ref/Slider])[n,{(Subscript[n, min]),(Subscript[n, max]),dn}] jumps to integer positions if (Subscript[n, min]) and dn are integers. »

(RefLink[Slider, paclet:ref/Slider])[x,{(Subscript[x, min]),(Subscript[x, max]),dx}] in general jumps to positions given by (RefLink[Range, paclet:ref/Range])[(Subscript[x, min]),(Subscript[x, max]),dx]. »

(RefLink[Slider, paclet:ref/Slider])[x] represents a slider running from left to right.

(RefLink[Slider, paclet:ref/Slider])[x,{(Subscript[x, max]),(Subscript[x, min])}] with (Subscript[x, max]) > (Subscript[x, min]) 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.

(RefLink[Slider, paclet:ref/Slider])[x,{0,1,dx}] displays at position x, even if this is not a multiple of dx.

In (RefLink[Slider, paclet:ref/Slider])[x,{{(Subscript[e, 1]),(Subscript[e, 2]),…}}], the (Subscript[e, i]) can be any expressions, not just numbers. »

The following options can be given:

Possible settings for (RefLink[Appearance, paclet:ref/Appearance]) include (RefLink[Tiny, paclet:ref/Tiny]), (RefLink[Small, paclet:ref/Small]), (RefLink[Medium, paclet:ref/Medium]), and (RefLink[Large, paclet:ref/Large]), as well as typically some other settings such as "UpArrow" and "DownArrow".

(RefLink[Appearance, paclet:ref/Appearance])->"Labeled" displays the current value of the slider as an editable label.

The settings for (RefLink[BaseStyle, paclet:ref/BaseStyle]) are appended to the default style typically given by the "Slider" style in the current stylesheet.

(RefLink[Slider, paclet:ref/Slider])[] is equivalent to (RefLink[Slider, paclet:ref/Slider])[0.5].

The resulting slider can be finely manipulated by holding down the (Key0[alt]) key (or (Key0[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 (Key0[shift]) and/or (Key0[ctrl]) keys.

OpenersPrimaryExamplesSection(Spacer1)Examples  (32)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

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

Slider[0.8]

A slider with its value updated dynamically:

{Slider[Dynamic[x]],Dynamic[x]}

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

{Slider[Dynamic[n],{0,100,1}],Dynamic[n]}

OpenersExampleSection1(Spacer1)Scope  (5)

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

x=0;{Slider[Dynamic[x],{-1,1}],Dynamic[x]}

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

y=0;{Slider[Dynamic[y],{1,-1}],Dynamic[y]}

Use only integer variable values:

{Slider[Dynamic[n],{0,100,1}],Dynamic[n]}

Use rational steps:

{Slider[Dynamic[x],{0,1,1/5}],Dynamic[x]}

Use slider increments of π:

{Slider[Dynamic[y],{0,10Pi,Pi}],Dynamic[y]}

Use a symbolic range:

{Slider[Dynamic[z],{a,20a,2a}],Dynamic[z]}

Use a list of possible values:

{Slider[Dynamic[x],{{a,2,True}}],Dynamic[x]}

Change the relative width corresponding to each possible value:

{Slider[Dynamic[x],{{{a,10},{2,5},{True,20}}}],Dynamic[x]}

OpenersExampleSection2(Spacer1)Options  (20)

OpenersExampleSubsection0(Spacer1)Appearance  (4)

Different sizes:

Table[Slider[0.5,Appearance->a],{a,{Tiny,Small,Medium,Large}}]

Add a label:

Slider[0.5,Appearance->"Labeled"]

Special arrow appearances are available on some platforms:

Table[Slider[0.5,Appearance->a],{a,{"UpArrow","DownArrow"}}]

Use dynamic appearance, based on whether (RefLink[Round, paclet:ref/Round])[x] is 0 or 1:

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

OpenersExampleSubsection1(Spacer1)AutoAction  (2)

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

{Slider[Dynamic[x]],Dynamic[x]}

By setting (RefLink[AutoAction, paclet:ref/AutoAction]), the slider values change as the mouse moves over the slider area:

{Slider[Dynamic[x],AutoAction->True],Dynamic[x]}

OpenersExampleSubsection2(Spacer1)Background  (2)

Change the background colors:

Table[Slider[0.5,Background->c],{c,{Pink,Green,Gray,Yellow}}]

Change the background color dynamically:

Slider[Dynamic[x],Background->Dynamic[Hue[x]]]

OpenersExampleSubsection3(Spacer1)BaselinePosition  (2)

Align with the surrounding text:

Row[Table[Slider[0.5,ImageSize->100,BaselinePosition->p],{p,{Top,Center,Bottom}}],"xxx"]

Dynamically change the baseline position:

{"x",Slider[Dynamic[x],{{Top,Center,Bottom}},BaselinePosition->Dynamic[x]],"x"}//Row

OpenersExampleSubsection4(Spacer1)ContinuousAction  (2)

By default, variables are continuously updated:

{Slider[Dynamic[x]],Dynamic[x]}

Setting (RefLink[ContinuousAction, paclet:ref/ContinuousAction]) to (RefLink[False, paclet:ref/False]) makes variables update only when the slider is released:

{Slider[Dynamic[y],ContinuousAction->False],Dynamic[y]}

OpenersExampleSubsection5(Spacer1)Enabled  (2)

By default, (RefLink[Slider, paclet:ref/Slider]) is enabled:

Slider[0.5]

By setting (RefLink[Enabled, paclet:ref/Enabled])->(RefLink[False, paclet:ref/False]), the slider is disabled but visible in its current state:

Slider[0.3,Enabled->False]

OpenersExampleSubsection6(Spacer1)Exclusions  (1)

Exclude values from the range:

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

OpenersExampleSubsection7(Spacer1)ImageMargins  (1)

By setting (RefLink[ImageMargins, paclet:ref/ImageMargins]), you make the slider area larger:

Table[Slider[0.5,ImageMargins->m,Background->Pink],{m,{0,5,10,20}}]

OpenersExampleSubsection8(Spacer1)ImageSize  (4)

Use preset values:

Column[Table[Slider[0.5,ImageSize->i],{i,{Tiny,Small,Medium,Large}}]]

Or use any values:

Column[Table[Slider[0.5,ImageSize->i],{i,{50,150,300,500}}]]

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

Slider[0.5,ImageSize->{Automatic,50}]

A fully custom image size:

Slider[0.5,ImageSize->{50,50}]

OpenersExampleSection3(Spacer1)Applications  (2)

Selecting the n(^th) prime:

DynamicModule[{n=1000},{Slider[Dynamic[n],{1,(10^5),1}],(Subscript[p, Dynamic[n]])⟶Dynamic[Prime[n]]}]

Selecting the n(^th) digit in the decimal expansion of π:

DynamicModule[{n=10000},{Slider[Dynamic[n],{1,(10^5),1}],(Subscript[π, Dynamic[n]])⟶Dynamic[First@First@RealDigits[Pi,10,1,-n]]}]

A color selector:

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[]}]]}]]

OpenersExampleSection4(Spacer1)Possible Issues  (1)

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

Slider[0.5,Appearance->"UpArrow"]

Generic appearances are available on all platforms:

Style[Slider[0.5,Appearance->"UpArrow"],ControlsRendering -> "Generic"]

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Randomly sized sliders:

DynamicModule[{x=Random[]},Column[Table[Slider[Dynamic[x],ImageSize->RandomReal[200]],{10}]]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[VerticalSlider, paclet:ref/VerticalSlider])  ▪  (RefLink[IntervalSlider, paclet:ref/IntervalSlider])  ▪  (RefLink[Manipulator, paclet:ref/Manipulator])  ▪  (RefLink[ProgressIndicator, paclet:ref/ProgressIndicator])  ▪  (RefLink[HorizontalGauge, paclet:ref/HorizontalGauge])  ▪  (RefLink[Locator, paclet:ref/Locator])  ▪  (RefLink[Animator, paclet:ref/Animator])  ▪  (RefLink[Slider2D, paclet:ref/Slider2D])  ▪  (RefLink[ColorSlider, paclet:ref/ColorSlider])  ▪  (RefLink[Control, paclet:ref/Control])  ▪  (RefLink[LocatorPane, paclet:ref/LocatorPane])  ▪  (RefLink[ControlsRendering, paclet:ref/ControlsRendering])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Introduction to Dynamic, paclet:tutorial/IntroductionToDynamic])}, {▪(RefLinkPlain[Introduction to Control Objects, paclet:tutorial/IntroductionToControlObjects])}, {▪(RefLinkPlain[Generalized Input, paclet:tutorial/GeneralizedInput])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Control Objects, paclet:guide/ControlObjects])}, {▪(RefLinkPlain[Form Structure & Layout, paclet:guide/FormStructureAndLayout])}, {▪(RefLinkPlain[Options & Styling for Interactive Manipulation, paclet:guide/OptionsAndStylingForInteractiveManipulation])}, {▪(RefLinkPlain[Dynamic Visualization, paclet:guide/DynamicVisualization])}, {▪(RefLinkPlain[Creating Form Interfaces & Apps, paclet:guide/CreatingFormsAndApps])}, {▪(RefLinkPlain[Dynamic Interactivity Language, paclet:guide/DynamicInteractivityLanguage])}, {▪(RefLinkPlain[Interactive Manipulation, paclet:guide/InteractiveManipulation])}, {▪(RefLinkPlain[Creating Inspectors, paclet:guide/CreatingInspectors])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-FastIntro.png(Spacer1)Fast Introduction for Programmers: Interactive Interfaces, http://www.wolfram.com/language/fast-introduction-for-programmers/interactive-interfaces/])}})}})