Updated

"Modern Family" star Sarah Hyland shocked fans with a close-up photo of her swollen face Thursday, revealing she had been hospitalized earlier in the week.

Wearing what appeared to be a hospital gown, Hyland, 27, told fans in an Instagram story that she had to immediately stop working and see a doctor due to unexpected health problems, which she did not disclose.

“Sometimes a selfie is more than just a good angle or feelin cute. This time for #NationalSelfieDay, I’ve decided to share my truth. As painful as it is,” the actress captioned a photo of her puffy face, Us Weekly reports. “So here is my face that was torn from work against my will. But I’m very grateful it was. Health should always come first.”

The unknown health scare happened on Monday, Hyland said, adding that her dog could tell she was having issues.

SELMA BLAIR CELEBRATES 2 YEARS SOBER: 'I'M A LIVING MIRACLE'

"She was literally telling me to get treatment," Hyland added.

Hyland has been candid about her health struggles over the years.

As a child, the actress suffered from kidney dysplasia, "a condition in which the internal structures of one or both of a fetus’ kidneys do not develop normally while in the womb," according to the National Institute of Diabetes and Digestive and Kidney Diseases. In 2012 she received a kidney transplant and has since been on medication.

In December, the star publicly criticized her local CVS pharmacy for not properly updating the status of her prescription, which resulted in her not getting her meds.

SARAH HYLAND GOES OFF ON CVS FOR ITS HANDLING OF HER PRESCRIPTION

“Hey @cvspharmacy when you tell a kidney transplant recipient that her medication will be ready before you close and that you will notify her when it’s ready to be picked up. F---ING DO IT BEFORE YOU CLOSE. PEOPLE LIKE ME CANT AFFORD TO GO WITHOUT MEDICATION," she demanded in a tweet.

If left unchecked, the star said her new kidney would be at risk of going into rejection, which would force her into dialysis and restart her search for a new kidney.

A source told Us Weekly Hyland had been filming "The Wedding Year" when she started feeling sick.

Fans sent Hyland messages of support on Thursday, telling the star to stay strong.

"I know what it feels like to be [in] and out of hospitals so often and to constantly be Ill over several years. I hope for your sake you feel better soon. With lots of love," one Twitter user wrote.

"I am sorry you are sick and can't work! Hope you have a great team of doctors and get back to fighting shape soon!" another added.

"Praying you find healing and relief," one fan wrote.

Fox News' Tyler McCarthy contributed to this report.