Implementation:
JButton
Use a link instead a button if:
The action takes the user to another page of the same dialog or an external source like documentation:
Exception: Next and Previous buttons in wizard navigation.
The command is a secondary action that is not related to the primary purpose of the window, and the space is constrained.
|
|
![]() |
![]() |
Use toolbar buttons instead if there are several buttons related to a table or list:
|
|
![]() |
![]() |
Use a split button instead if:
Use a built-in button instead if it's related to an input field, combo box, search field.
The label displays the action the button performs.
Write the label as an imperative verb, e.g. Save, Print, Cancel. Use title capitalization.
Exceptions: standard buttons like OK, Back/Forward, Previous/Next, Yes/No, Agree, Options, Settings, Details.
The button should answer the question in the title, so the user can skip the description. Prefer specific labels over generic ones:
|
|
![]() Unclear what happens on the click. |
![]() The label indicates what happens on the click. |
The label should be short, not more than 5 words. If it’s not obvious what element the button is related to, add more words to make it clear. Prefer clear labels to short:
|
|
![]() |
![]() |
Add an ellipsis if additional actions such as adding more info or confirming the action are required:
Do
Do not
use the word
|
|
![]() |
![]() |
![]()
|
![]()
|
The default button should always be present in a dialog. Only one button in a dialog can be the default one.
If the action is dangerous, e.g., can lead to data loss, provide an easy way to undo the command.
If it's not possible to undo the action, make a secondary button the default one:
All buttons can get focus, even on macOS if the
A focused button is invoked by pressing
Make the second most popular button in the dialog focused.
For example, the
It’s recommended to have one default and one focused button, so that most of the actions can be triggered using the keyboard.
Disable a button if:
Other common buttons are described below. They can be regular or default buttons.
On hovering over a button, show a tooltip with the shortcut and the action name if it can be clarified. For more details, see Context help.
![]()
|
![]()
|
The
Use the Apply button in dialogs with many settings that affect how data is displayed. The Apply button allows you to save and preview the effect of the selected options, and continue changing the settings, for example, change a scheme in Settings.
The help button appears in the bottom-left corner of a dialog and shows help in a tooltip on hover, or
opens a help
dialog when clicking it. For more details, see Context help.
Use the
Do not add an icon to the button. The main purpose of an icon is to quickly find a familiar action in a packed toolbar or menu. Usually, no more than 3 buttons are placed nearby, their labels can be scanned quickly, and icons are not required.
The button width accommodates the length of the label plus standard indents 14px, but not less than the 72px.
The button height is fixed, so the label is always a single line.
To lay out the button that depends on other control, e.g., input field, follow the rules for dependent controls. Otherwise, follow the rules for independent controls.