lose (one's) buttons
To be or become mentally deficient, incompetent, or deranged; to become of unsound mind. My poor grandmother started losing her buttons after she had a stroke on her 84th birthday. I've been so sleep deprived lately that it feels like I'm losing my buttons!
lose one's buttons
see under have all one's buttons.