Sarah Hyland has slammed trolls who criticised her over wearing Spanx to the Vanity Fair Oscars party.

The 'Modern Family' star revealed she wore two pairs of the shaping underwear for the Academy Awards bash in Los Angeles on Sunday (24.02.19), but was met with a number of negative comments about her undergarment choice because she has previously undergone two kidney transplants.

Alongside a snap of her outfit from the red carpet, she wrote on Instagram: ''#funfact I'm wearing TWO pairs of spanx. Why diet? When you can just hide it!''

When one fan wrote, ''If you're trying to hide the bump from your transplant, forget it. I've been trying for years!! Stay healthy. #kidneystrong #transplantssavelives'', Sarah wrote back: ''Someone gets it.''

When another follower posted a since-deleted comment on Twitter, the actress replied: ''When you have two kidney transplants and are on steroids for life get back to me.''

The 28-year-old star has been open about her battle with her health and recently admitted she was ''very close'' to taking her own life as she struggled with depression.

She said: ''I would write letters in my head to loved ones of why I did it and my reasoning behind it, how it was nobody's fault. I didn't want to write it down on paper because I didn't want anybody to find it. That's how serious I was ... It ended up being myself that got me out of that. I had to do it on my own. I told myself I had to do it on my own.''

Sarah turned to a friend and verbalised her thoughts, which sparked a change and ''helped immensely''.

However, Sarah was keen to point out that while it worked for her, she understands everyone with depression handles it differently.

She added: ''Every person with their anxiety or depression or if you have suicidal thoughts, every individual is different, so I wouldn't just rely on everything that I say.

''I'm just sharing my story. But I think talking to someone and saying it out loud really, really makes it sound almost ridiculous and it puts it into perspective.''

Now, almost two years on from her second procedure, the star is feeling much better and has been enjoying vacations with her hugely supportive boyfriend Wells Adams.

She recently revealed: ''I'm doing really really well. I just came back from Mexico and that was really, really nice. The good thing about being stable, health-wise, and having an amazing significant other is that now I'm able to travel more ... The last time I took a vacation before this year I was 24. I just turned 28, so I've just been either working on my health or working nonstop, so it's really good to be able to do something like that now.''