({{, (RefLink[DefaultButton, paclet:ref/DefaultButton])[] 
represents an OK button that closes a dialog, and is the default when (Key0[MacOSXreturnenter]) is pressed in the dialog.}, {, (RefLink[DefaultButton, paclet:ref/DefaultButton])[action] 
represents a button that is labeled OK, and whose action is to evaluate action.}, {, (RefLink[DefaultButton, paclet:ref/DefaultButton])[label,action] 
uses label as the label for the button.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[DefaultButton, paclet:ref/DefaultButton])[] is equivalent to (RefLink[DefaultButton, paclet:ref/DefaultButton])[(RefLink[DialogReturn, paclet:ref/DialogReturn])[]].

In dialogs created with (RefLink[DialogInput, paclet:ref/DialogInput]) or (RefLink[CreateDialog, paclet:ref/CreateDialog]), pressing (Key0[MacOSXreturnenter]) is effectively equivalent to clicking the OK button.

If there are several default buttons in a single dialog, (Key0[MacOSXreturnenter]) will use the first one in the dialog.

(RefLink[DefaultButton, paclet:ref/DefaultButton]) has the same options as (RefLink[Button, paclet:ref/Button]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Create dialog input, and use (RefLink[DefaultButton, paclet:ref/DefaultButton]) to dismiss dialog:

DialogInput[DefaultButton[]]

OpenersExampleSection2(Spacer1)Applications  (1)

Create a dialog with a (RefLink[Locator, paclet:ref/Locator]), and return the last location:

DialogInput[{LocatorPane[Dynamic[coord],Framed@Graphics[{},ImageSize->Tiny]],Dynamic[coord],DefaultButton[DialogReturn[coord]]}]

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

(RefLink[DefaultButton, paclet:ref/DefaultButton]) is a special case of (RefLink[Button, paclet:ref/Button]):

DefaultButton[]

Button["OK",DialogReturn[],Appearance->{"DialogBox","Pressed"}]

Create a dialog with an OK button; the window is dismissed with a click or (Key0[MacOSXreturnenter]):

CreateDialog[DefaultButton[]];

Create a dialog that holds evaluations until the dialog is dismissed:

DialogInput[DefaultButton[]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Button, paclet:ref/Button])  ▪  (RefLink[CancelButton, paclet:ref/CancelButton])  ▪  (RefLink[ChoiceButtons, paclet:ref/ChoiceButtons])  ▪  (RefLink[PasteButton, paclet:ref/PasteButton])  ▪  (RefLink[DialogReturn, paclet:ref/DialogReturn])  ▪  (RefLink[DialogInput, paclet:ref/DialogInput])  ▪  (RefLink[CreateDialog, paclet:ref/CreateDialog])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Creating Dialog Boxes, paclet:tutorial/CreatingDialogBoxes])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Dialog Boxes, paclet:guide/DialogBoxes])}})}})