An action or feature that can be handled in a modal popup. Always provide options to cancel the action and leave the modal (e.g. a close button in the top and a cancel button in the bottom). Use a primary colored button to highlight the action needed.
Do not use modals for very complex tasks; they can be difficult to handle on smaller devices.
Buttons in footer
By seperating them, you can have multiple buttons in the modal footer. Standard behavior is buttons aligning to the right. Look at the following example code on how to have one or more buttons aligning to left:
Example use case: The user initiated a delete function. You can use a modal popup to ask the user to confirm this destructive action. Use a red button to signal caution.
Example use case: An action initiated by the user has completed successfully. You can use a modal popup to tell it to the user. Use a green button, or icon, to signal success.