Director Olivia Wilde has paid a gushing tribute to Harry Styles, praising him for his “humility and grace” while starring in her film Don’t Worry Darling.

The film hit the headlines after Wilde, 36, was romantically linked to Styles, 27.

After production on the psychological thriller wrapped, Wilde posted a glowing tribute to the former One Direction singer, praising him for his willingness to star in a female-led film.

Styles appears alongside British actress Florence Pugh, who is in the lead role.

Wilde posted a black-and-white picture of Styles in a vintage car to Instagram, and wrote: “Little known fact: most male actors don’t want to play supporting roles in female-led films. The industry has raised them to believe it lessens their power (i.e financial value) to accept these roles, which is one of the reasons it’s so hard to get financing for movies focusing on female stories.

“No joke, it is harrrrrd to find actors who recognise why it might be worth it to allow for a woman to hold the spotlight.”

Wilde added: “Enter: @harrystyles, our ‘Jack’ . Not only did he relish the opportunity to allow for the brilliant @florencepugh to hold centre stage as our ‘Alice’, but he infused every scene with a nuanced sense of humanity.

“He didn’t have to join our circus, but he jumped on board with humility and grace, and blew us away every day with his talent, warmth, and ability to drive backwards.”

Don’t Worry Darling stars Styles in his second major Hollywood role, alongside Oscar-nominee Pugh and US actor Chris Pine.

It is set in the 1950s in an isolated, utopian community in the California desert and features an unhappy housewife and her husband who harbours a dark secret.

Wilde, an actress known for her work on TV series House, was engaged to actor and comedian Jason Sudeikis, with whom she has two children.

The cast and crew of Don’t Worry Darling posed for a picture together to celebrate the film wrapping up production.

Asif Ali posted it to Instagram on Sunday. It showed Styles with his arm around Wilde.