Ned Vizzini, a precocious and highly praised writer of popular young-adult novels that often dealt with themes of teenage anxiety and depression — and still made readers laugh — died on Thursday in Brooklyn. He was 32.

He took his own life, according to his father, James. The New York City chief medical examiner’s office said he suffered blunt impact injuries. The writer’s brother, Daniel, told reporters that Mr. Vizzini had jumped off the roof of the building where their parents live.

Mr. Vizzini wrote openly about his struggles with depression and spoke about it with student groups. One of his most celebrated novels, “It’s Kind of a Funny Story,” published in 2006, is based on the five days he spent in the psychiatric ward of a Brooklyn hospital in 2004.

That was the same year he published his well-received first novel, “Be More Chill,” about an insecure high school student who becomes more confident after ingesting a pill-sized supercomputer. The success of “Be More Chill” brought him a contract to write two more books, but his initial excitement faded as he began to struggle with the writing and fell into despair.