How to add a minimise button on the dialog box

Hello,

Someone help me to add a minimize button on the dialog box, also I want if the user clicks in space when they have added data, and then open the dialog box again the data they entered first doesn’t disappear.

Just like in the Email Dialog Box