Some software systems use the secondary button for cancel/close functions, and others use the warning button (usually red). Which is more correct?

  • Could you give some examples of what you mean by dependable software? Shouldn't all software be dependable?
    – Blue Ocean
    Jan 4, 2022 at 14:20

2 Answers 2


A warning button is used in the case of destructive actions or data loss. If the close/cancel function will lead to the user losing changes or work, it's acceptable to use this type of button, even if the user didn't make changes. We don't usually see it used often with "Close", and even "Cancel" is a bit of a weak action for a destructive function - it's better to say "Discard changes" or something that clarifies the loss of data.

On the other hand, if the user is simply closing or canceling an informational panel or unwanted task and there's no data loss, a secondary button can be used.

  • Thank you. But if the user ie. open edit view and tries to edit some data, later on user decides to close this window without any changes - shall this close button be a warning button or secondary button? changes haven't been made and data is same as it was cause he didn't edit anything at the end...and if he would than warning dialog box appears... Jan 6, 2022 at 9:18
  • I noticed that ie. on GitHub they use a warning button for "close" while editing. I just wonder if this is a good approach. Jan 6, 2022 at 9:18
  • so you would suggest "discard changes" in his case and usage of a secondary button rather than warning button due to the fact that "cancel" is too weak action for destructive action? Jan 6, 2022 at 9:20
  • It sounds like there is the potential for data loss, so "Discard changes" in the warning state sounds correct, whether the user makes changes or not.
    – Izquierdo
    Jan 6, 2022 at 15:04
  • thank you so much Jan 7, 2022 at 10:32

Use the simple Close or Cancel button when:

  • Wanting to close that view to continue some other related activity.

Use the Alert button before closing or cancel when there is/are a:

  • Running timer
  • Playing audio
  • Several filter options selected
  • Some type of unsaved work

More detailed examples in this article: Cancel vs Close

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.