No need to pay attention to the above comment. People who haven’t had mental health problems think its just a sad day that one can get over.
I will ask you/people this - would one still be asking this question if it was a physical illness? Is it okay to take a break if I’m on bedrest? They would not. Sadly mental health doesn’t get the same treatment. This is coming from someone who took a 1 month unpaid sabbatical for my mental health. (Medically diagnosed anxiety with medication so trust me I understand)
As long as you are able to support yourself financially, do as you wish and you are answerable to no one. It is your health and your body- when shit hits the ceiling none of these people will be there to help you no matter how hard you worked at your job, it is you who will need to take care of yourself.
In 5, 10, 20 years this break will not matter to your career. But if you ignore your health and god forbid it becomes worse, then no amount of job prestige or money can solve it.