This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Toggler

Toggler[x]
represents a toggler button with setting x, that toggles between True and False.
Toggler[Dynamic[x]]
takes the setting to be the dynamically updated current value of x, with the value of x being toggled if the button is clicked.
Toggler
represents a toggler button that cycles through any sequence of values .
Toggler
cycles through values displaying them as .
Toggler
displays as dpict if x is none of the .
  • Toggler[x] by default displays as x.
  • Clicking anywhere inside a Toggler advances to the next value.
  • Shift-clicking goes to the previous value.
  • The dpict case cannot be reached by clicking, only by externally setting x. »
  • The and in Toggler can be strings, boxes, graphics or any other expressions, including dynamic expressions. »
  • The following options can be given:
AutoActionFalsewhether to change the toggler automatically when the mouse is over it
BaselinePositionAutomaticalignment relative to surrounding text
BaseStyle{}base style specifications for the displayed toggler
EnabledAutomaticwhether the toggler is enabled, or grayed out
ImageMargins0margins around the image of the displayed toggler
ImageSizeAllthe overall image size of the displayed toggler
  • The settings for BaseStyle are appended to the default style typically given by the style in the current stylesheet.
Click the output to toggle its value:
Dynamically change the value of :
Click the output to toggle its value:
In[1]:=
Click for copyable input
Out[1]=
 
Dynamically change the value of :
In[1]:=
Click for copyable input
Out[1]=
Include labels:
Display the last element () since the setting is not in the list of values:
Sometimes the setting is affected by external actions; in this display, :
Use any type of expression as values:
Align labels in the toggler:
All possible alignment positions:
By default, clicking the output toggles its value:
By setting AutoAction->True, the value toggles when the mouse moves over the output:
Specify the background color:
Align with surrounding text:
By default Toggler is enabled:
By setting Enabled->False, the toggler is disabled but visible in its current state:
Increase the clickable area:
Add margins to the toggler image:
Use numeric values:
Use Toggler to create a tic-tac-toe board, where every cell knows the game logic:
Checkbox and Opener are special cases of Toggler:
New in 6