Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
Button
  • See Also
    • DefaultButton
    • CancelButton
    • PasteButton
    • ClickToCopy
    • Hyperlink
    • ButtonBar
    • ActionMenu
    • Setter
    • RadioButton
    • Panel
    • Dynamic
    • Input
    • ButtonNotebook
    • DialogReturn
    • PopupWindow
    • ClickPane
    • Trigger
    • EmitSound
    • Speak
  • Related Guides
    • Control Objects
    • Graph Visualization
    • Palettes
    • Graph Styling, Labeling, and Layout
    • Custom Interface Construction
    • Toolbars
    • Dynamic Visualization
    • Dialog Boxes
    • Standalone Interfaces
  • Workflows
    • Create a Palette
  • Tech Notes
    • Introduction to Dynamic
    • Introduction to Control Objects
    • Generalized Input
    • See Also
      • DefaultButton
      • CancelButton
      • PasteButton
      • ClickToCopy
      • Hyperlink
      • ButtonBar
      • ActionMenu
      • Setter
      • RadioButton
      • Panel
      • Dynamic
      • Input
      • ButtonNotebook
      • DialogReturn
      • PopupWindow
      • ClickPane
      • Trigger
      • EmitSound
      • Speak
    • Related Guides
      • Control Objects
      • Graph Visualization
      • Palettes
      • Graph Styling, Labeling, and Layout
      • Custom Interface Construction
      • Toolbars
      • Dynamic Visualization
      • Dialog Boxes
      • Standalone Interfaces
    • Workflows
      • Create a Palette
    • Tech Notes
      • Introduction to Dynamic
      • Introduction to Control Objects
      • Generalized Input

Button[label,action]

represents a button that is labeled with label, and evaluates action whenever it is clicked.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Button Content  
Button Control  
Button Styles  
Generalizations & Extensions  
Options  
Alignment  
Appearance  
AutoAction  
Show More Show More
Background  
BaselinePosition  
BaseStyle  
ContentPadding  
Enabled  
Evaluator  
FrameMargins  
ImageMargins  
ImageSize  
Method  
Applications  
Properties & Relations  
Possible Issues  
Neat Examples  
See Also
Tech Notes
Related Guides
Related Workflows
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • DefaultButton
    • CancelButton
    • PasteButton
    • ClickToCopy
    • Hyperlink
    • ButtonBar
    • ActionMenu
    • Setter
    • RadioButton
    • Panel
    • Dynamic
    • Input
    • ButtonNotebook
    • DialogReturn
    • PopupWindow
    • ClickPane
    • Trigger
    • EmitSound
    • Speak
  • Related Guides
    • Control Objects
    • Graph Visualization
    • Palettes
    • Graph Styling, Labeling, and Layout
    • Custom Interface Construction
    • Toolbars
    • Dynamic Visualization
    • Dialog Boxes
    • Standalone Interfaces
  • Workflows
    • Create a Palette
  • Tech Notes
    • Introduction to Dynamic
    • Introduction to Control Objects
    • Generalized Input
    • See Also
      • DefaultButton
      • CancelButton
      • PasteButton
      • ClickToCopy
      • Hyperlink
      • ButtonBar
      • ActionMenu
      • Setter
      • RadioButton
      • Panel
      • Dynamic
      • Input
      • ButtonNotebook
      • DialogReturn
      • PopupWindow
      • ClickPane
      • Trigger
      • EmitSound
      • Speak
    • Related Guides
      • Control Objects
      • Graph Visualization
      • Palettes
      • Graph Styling, Labeling, and Layout
      • Custom Interface Construction
      • Toolbars
      • Dynamic Visualization
      • Dialog Boxes
      • Standalone Interfaces
    • Workflows
      • Create a Palette
    • Tech Notes
      • Introduction to Dynamic
      • Introduction to Control Objects
      • Generalized Input

Button

Button[label,action]

represents a button that is labeled with label, and evaluates action whenever it is clicked.

Details and Options

  • 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 clicked.
  • The following options can be given:
  • Alignment Automatichow to align contents within the button
    Appearance Automaticthe overall appearance of the button
    AutoAction Falsewhether to click the button automatically when the mouse is over it
    Background Automaticbutton background color
    BaselinePosition Automaticalignment relative to surrounding text
    BaseStyle "GenericButton"base style specifications for the button
    ContentPadding Truewhether to shrink the margins tightly around the contents
    Enabled Automaticwhether the button is enabled or grayed out
    Evaluator Automaticthe kernel in which to evaluate expr
    FrameMargins Automaticminimum margins to leave inside the frame
    ImageMargins 0margins around the image of the displayed button
    ImageSize Fullthe overall image size of the displayed button
    Method "Preemptive"the evaluation method to use
    TooltipNonethe tooltip for the button
    TooltipDelay0.`how long to delay before displaying the tooltip
    TooltipStyle{}style specifications for the tooltip
  • 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.
  • Settings of Tiny, Small, Medium, and Large for ImageSize specify buttons with certain system-standard minimum sizes.
  • 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. »
  • Typical possible settings for the Method option include "Preemptive" and "Queued".
  • With the default setting Method->"Preemptive", button actions are performed immediately, preempting any other evaluation, but are allocated only a limited time to complete.
  • With the setting Method->"Queued", button actions are added to the current queue of evaluations, and are performed when other evaluations are complete. No time limit is applied.
  • 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. »
  • Button[label,None,BaseStyle->stylename] inherits button functionality from the definition of stylename in the stylesheet. Such styles typically allow \[SelectionPlaceholder] to be used in label to represent the currently selected text.
  • Some style names defined in default stylesheets that provide Button functionality:
  • "Paste"effectively use NotebookApply upon the current selection using the button label as the applied data
    "Evaluate"use NotebookApply and SelectionEvaluate in sequence upon the current selection
    "EvaluateCell"use NotebookApply upon the current selection, then evaluate the entire cell containing the selection
    "CopyEvaluate"equivalent to "Evaluate", but paste the result into a new cell instead of changing the currently selected cell
    "CopyEvaluateCell"equivalent to "EvaluateCell", but apply changes to a newly created copy of the input cell instead of changing the currently selected cell

Examples

open all close all

Basic Examples  (1)

Create a button that prints a number:

Scope  (7)

Button Content  (3)

Use any expression as a label:

Use a dynamic label:

Use a graphics primitive as a button:

Button Control  (2)

Create a list of buttons; use With to ensure evaluation of i:

Another way to get the contents of a button evaluated:

Display the label literally, without the appearance of a button:

Button Styles  (2)

Display a button that sorts the selected expression:

Select the list below, and click the button to sort it:

Display a button that wraps Factor around an expression, then evaluates the entire cell:

Select the first three terms below, then click the button to factor them:

Generalizations & Extensions  (2)

Get the mouse position in screen coordinates:

Get the mouse position in graphics coordinates:

Options  (23)

Alignment  (1)

Different predefined alignment options:

Appearance  (4)

Predefined button appearances:

On some platforms, the following appearances are also defined:

Use a second element to get the appearance of a pressed button:

Use a special appearance for the button:

AutoAction  (1)

By default, the button function does not evaluate until you click it:

By setting AutoAction, the button function evaluates as you mouse over the button area:

Background  (2)

Change the background colors:

Change the background color on every click:

BaselinePosition  (2)

Align with the surrounding text:

Change the baseline position on every button click:

BaseStyle  (2)

Add styles to a button:

Select the behavior of a button:

Select the expression below and click the above button to expand inline:

ContentPadding  (1)

Remove extra whitespace around a label with no ascenders or descenders:

Enabled  (1)

By default, Button is enabled:

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

Evaluator  (1)

By default, the button function is sent to the kernel for evaluation:

By setting Evaluator, the button function is evaluated in the front end:

Not all functionalities are available in the front end:

FrameMargins  (1)

By setting FrameMargins, you make the button content area larger:

ImageMargins  (1)

By setting ImageMargins, you make the button area larger:

ImageSize  (4)

Use preset values:

Or use any values:

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

A fully customized image size:

Method  (2)

By default, button functions are evaluated on a preemptive link and time out after 5 seconds:

Use Method->"Queued" to evaluate button functions on the main link, which never times out:

Specify that the stop button event needs to preemptively interrupt an evaluation:

Applications  (5)

Make a button that prints the current date:

Create a button that deletes itself:

Create your own hyperlink:

Change color on mouseover:

Create a button that sorts a selected list of items in place:

Select the list below and click the above button to sort the list:

Properties & Relations  (2)

Create a grid of tightly spaced buttons:

Create a button that makes the button the current selection:

Possible Issues  (4)

Some functions require the kernel in order to be evaluated:

Specifying the Background option forces a generic appearance for the button:

Use ImageSize to control buttons in a Grid:

Use Method->"Queued" to avoid evaluation timeout on the preemptive link:

Neat Examples  (3)

This button changes the color of the disk each time you click it:

This button changes position each time you click it:

Use a graphics primitive as the button:

See Also

DefaultButton  CancelButton  PasteButton  ClickToCopy  Hyperlink  ButtonBar  ActionMenu  Setter  RadioButton  Panel  Dynamic  Input  ButtonNotebook  DialogReturn  PopupWindow  ClickPane  Trigger  EmitSound  Speak

Function Repository: ToggleButton  ButtonWithStatus  DynamicEnabledButton  CellEvaluationButton

Tech Notes

    ▪
  • Introduction to Dynamic
  • ▪
  • Introduction to Control Objects
  • ▪
  • Generalized Input

Related Guides

    ▪
  • Control Objects
  • ▪
  • Graph Visualization
  • ▪
  • Palettes
  • ▪
  • Graph Styling, Labeling, and Layout
  • ▪
  • Custom Interface Construction
  • ▪
  • Toolbars
  • ▪
  • Dynamic Visualization
  • ▪
  • Dialog Boxes
  • ▪
  • Standalone Interfaces

Related Workflows

    Related Workflows
    ▪
  • Create a Palette

History

Introduced in 2007 (6.0) | Updated in 2010 (8.0)

Wolfram Research (2007), Button, Wolfram Language function, https://reference.wolfram.com/language/ref/Button.html (updated 2010).

Text

Wolfram Research (2007), Button, Wolfram Language function, https://reference.wolfram.com/language/ref/Button.html (updated 2010).

CMS

Wolfram Language. 2007. "Button." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/Button.html.

APA

Wolfram Language. (2007). Button. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Button.html

BibTeX

@misc{reference.wolfram_2025_button, author="Wolfram Research", title="{Button}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/Button.html}", note=[Accessed: 01-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_button, organization={Wolfram Research}, title={Button}, year={2010}, url={https://reference.wolfram.com/language/ref/Button.html}, note=[Accessed: 01-December-2025]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Player
  • Wolfram Engine

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English