Former Prime Minister Julia Gillard has weighed in on the mental state of US president Donald Trump as she steps into the role of Beyond Blue chair.

Speaking to Lateline, Ms Gillard said she struggled with anxiety at times during her prime ministership and she had to find ways to cope with the "poison" directed at her via social media.

Ms Gillard, who takes over from Beyond Blue founder Jeff Kennett, said she's looking forward to once again "courting the public light" in the name of the mental health charity.

Not surprised by commentary on Trump's mental health

"I would worry that a charge of being mentally ill ended up being thrown around as an insult," Ms Gillard said. "I know that some people in the US, some commentators are not proffering that analysis by way of insult, they're actually saying it because they are genuinely concerned. "From the outside I think it is very difficult to judge someone else's mental health … so I think there's some need for caution here. "But I do think if President Trump continues with some of the tweeting etcetera that we've seen, that this will be in the dialogue."

'I had moments of anxiety'

"Obviously everybody has moments of anxiety, and I had moments of anxiety, but I did think about what I needed to do to protect my mental health when I was in the rigours of public life," she said. "As I looked at very negative media headlines — dreadful things on social media — and I did consciously think, I've got some choices to make now about how much I let of this into my head. "How much of this poison gets in my head and stays with me? "I've got some choices about how much I brood, or whether I go to bed and sleep soundly. I made some very deliberate choices, so I wouldn't let it get in my head, I would sleep soundly at night. "I also know now from my period at Beyond Blue, just because in the past I've been able to withstand quite strong pressures without having an episode of mental ill-health, doesn't mean you can say as an individual, gee I'm immune. I mean no one is immune."

'Jarring voices' in same-sex marriage debate

"Should we ever have such a plebiscite, then I think there would be a lot of weight on everyone, including all political participants from all political parties, to make sure that the debate was respected," she said. "I would be concerned that that kind of debate could have within it some very jarring voices which would compound this problem of stigma."

Julia Gillard and Lateline's David Lipson. ( ABC News: Jamie Cummins )

Media responsible for shift in western politics

"The rhythm of politics has been profoundly disrupted by the changes to the media cycle and the advent of social media, so the way in which the electorate perceives and sees politics and politicians is different now," she said. "The thing that concerns me, and this is a question for the media as much as it's a question for today's politicians, whether they're US politicians, or Australian politicians or anywhere else in the world: "It seems to me it's harder now to sustain the focused attention you need for deep reform conversations. "The media caravan wants to very quickly move on and I saw that when I was prime minister. You would literally announce a multi-billion-dollar, huge new policy in a blue room press conference mid-morning, and by mid-day journalists from the press gallery would be ringing my press secretary saying, 'have you got a story for us?'"

How does Gillard want to leave Beyond Blue?