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


Button[label, action]
represents a button that is labeled with label, and evaluates action whenever it is pressed.
  • label can be any expression, including a dynamic one.  »
  • Button by default displays label in "Button" style, which typically uses the system button font.
  • Button[label, action] maintains action in unevaluated form, evaluating it each time the button is pressed.
  • The following options can be given:
AlignmentAutomatichow to align contents within the button
AppearanceAutomaticthe overall appearance of the button
AutoActionFalsewhether to press the button automatically when the mouse is over it
BackgroundAutomaticbutton background color
BaselinePositionAutomaticalignment relative to surrounding text
BaseStyle{}base style specifications for the button
EnabledAutomaticwhether the button is enabled, or grayed out
EvaluatorAutomaticthe kernel in which to evaluate expr
FrameMarginsAutomaticminimum margins to leave inside the frame
ImageMargins0margins around the image of the displayed button
ImageSizeFullthe overall image size of the displayed button
Method"Preemptive"the evaluation method to use
  • With the default setting ImageSize->Full a button will be sized to fill out its enclosing region in a Grid or related construct.
  • The setting ImageSize->Automatic specifies that the button will be sized to fit its contents, but will not expand to fill out an enclosing region.
  • Typical possible settings for the Appearance option include "DialogBox", "Frameless", "Palette" and "FramedPalette". In some cases, "AbuttingLeftRight", "AbuttingRight", etc. are also supported.
  • Appearance->"Pressed" gives a button with a pressed appearance. Appearance->{type, "Pressed"} gives a button of a certain type with a pressed appearance.
  • With Appearance->None, label is displayed literally, without being placed in a button.  »
  • With the default setting Alignment->Automatic, the alignment of the contents of a button will be determined by alignments specified by an object that contains the button.
  • Typical possible settings for the Method option include "Preemptive" and "Queued".
  • The settings for BaseStyle are appended to the default style typically given by the "Button" style in the current stylesheet.
  • Button[label] displays as a button labeled with label, but performs no action.
  • Button[prims, action] can be used within graphics objects to specify that action should be evaluated whenever the graphics primitives prims are clicked.  »
New in 6