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 to .

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 .

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

Details and OptionsDetails 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 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 > 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 can be any expressions, not just numbers. »
  • The following options can be given:
  • AppearanceAutomaticthe overall appearance of the slider
    AutoActionFalsewhether to move the slider automatically when the mouse is over it
    BaselinePositionAutomaticalignment relative to surrounding text
    BaseStyle{}base style specifications for the slider
    ContinuousActionTruewhether to update continuously when the slider is moved
    EnabledAutomaticwhether the slider is enabled, or grayed out
    Exclusions{}specific values to be excluded
    ImageMargins0margins around the image of the displayed slider
    ImageSizeAutomaticthe 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 and .
  • 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 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 Option 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.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

A slider set at in the default range to :

In[1]:=
Click for copyable input
Out[1]=

A slider with its value updated dynamically:

In[1]:=
Click for copyable input
Out[1]=

A slider with integer values in the range to :

In[1]:=
Click for copyable input
Out[1]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »