represents an OK button that closes a dialog, and is the default when ![TemplateBox[{return}, Key0, BaseStyle -> {Usage, FontWeight -> Plain, FontFamily -> Source Sans Pro}] TemplateBox[{return}, Key0, BaseStyle -> {Usage, FontWeight -> Plain, FontFamily -> Source Sans Pro}]](Files/DefaultButton.en/10.png) is pressed in the dialog.
 is pressed in the dialog.
DefaultButton[action]
represents a button that is labeled OK, and whose action is to evaluate action.
DefaultButton[label,action]
uses label as the label for the button.
 
     
   DefaultButton
represents an OK button that closes a dialog, and is the default when ![TemplateBox[{return}, Key0, BaseStyle -> {Usage, FontWeight -> Plain, FontFamily -> Source Sans Pro}] TemplateBox[{return}, Key0, BaseStyle -> {Usage, FontWeight -> Plain, FontFamily -> Source Sans Pro}]](Files/DefaultButton.en/1.png) is pressed in the dialog.
 is pressed in the dialog.
DefaultButton[action]
represents a button that is labeled OK, and whose action is to evaluate action.
DefaultButton[label,action]
uses label as the label for the button.
Details and Options
 
   - DefaultButton[] is equivalent to DefaultButton[DialogReturn[]].
- In dialogs created with DialogInput or CreateDialog, pressing ![TemplateBox[{return}, Key0, BaseStyle -> {Notes, FontWeight -> Plain, FontFamily -> Source Sans Pro}] TemplateBox[{return}, Key0, BaseStyle -> {Notes, FontWeight -> Plain, FontFamily -> Source Sans Pro}]](Files/DefaultButton.en/2.png) is effectively equivalent to clicking the OK button. is effectively equivalent to clicking the OK button.
- If there are several default buttons in a single dialog, ![TemplateBox[{return}, Key0, BaseStyle -> {Notes, FontWeight -> Plain, FontFamily -> Source Sans Pro}] TemplateBox[{return}, Key0, BaseStyle -> {Notes, FontWeight -> Plain, FontFamily -> Source Sans Pro}]](Files/DefaultButton.en/3.png) will use the first one in the dialog. will use the first one in the dialog.
- DefaultButton has the same options as Button.
List of all options
 
       Examples
open all close allBasic Examples (1)
Create dialog input, and use DefaultButton to dismiss dialog:
Applications (1)
Create a dialog with a Locator, and return the last location:
Properties & Relations (3)
DefaultButton is a special case of Button:
Create a dialog with an OK button; the window is dismissed with a click or ![TemplateBox[{return}, Key0, BaseStyle -> {ExampleText, FontWeight -> Plain, FontFamily -> Source Sans Pro}] TemplateBox[{return}, Key0, BaseStyle -> {ExampleText, FontWeight -> Plain, FontFamily -> Source Sans Pro}]](Files/DefaultButton.en/6.png) :
:
Create a dialog that holds evaluations until the dialog is dismissed:
Tech Notes
Related Guides
History
Text
Wolfram Research (2007), DefaultButton, Wolfram Language function, https://reference.wolfram.com/language/ref/DefaultButton.html.
CMS
Wolfram Language. 2007. "DefaultButton." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DefaultButton.html.
APA
Wolfram Language. (2007). DefaultButton. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DefaultButton.html
BibTeX
@misc{reference.wolfram_2025_defaultbutton, author="Wolfram Research", title="{DefaultButton}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/DefaultButton.html}", note=[Accessed: 30-October-2025]}
BibLaTeX
@online{reference.wolfram_2025_defaultbutton, organization={Wolfram Research}, title={DefaultButton}, year={2007}, url={https://reference.wolfram.com/language/ref/DefaultButton.html}, note=[Accessed: 30-October-2025]}
 
       
       
      