You need a good explanation for the gap, but “I was seriously ill” is a good explanation.
As an interviewer I would not ask for details if someone told me that, partly because it’s none of my business and partly because it’s getting close to some legally-best-avoided topics. If an interviewer does ask (which is unlikely), you can politely decline by saying something like “I’d prefer not to go into detail about my illness; I’m fully recovered now” (assuming that’s true).
I recommend that you aren’t completely open about what kind of illness it was, because unfortunately there is still a stigma against mental illness among many people, and because your medical history is none of their business.
Don’t be tempted to fake the dates in your resume to avoid the issue; I would totally hire someone who was off work for 6 months because they were ill, but there is no way I would hire someone who lied to me on their CV.