How to activate and deactivate UI buttons

I want UI buttons to show up at certain times but disappear at different times. For now whenever I want it to disappear I just change the location of it to way off the screen but it is getting messy and I would appreciate if someone could tell me how to do it the proper way.
Thanks

yourButton.gameObject.SetActive(false); //set true if otherways.