British pop star Harry Styles has written a song with soul icon John Legend.

The One Direction star has penned more than 20 tracks as part of his work away from his band, but he has previously insisted he has no plans to ditch his bandmates in favour of a solo career.

The collaboration with Legend has been pitched to the winners of the final series of U.S. Tv talent show The X Factor, Alex Kinsey and Sierra Deaton, who hail Styles as an "amazing" songwriter.

Deaton is quoted by Britain's Daily Mirror newspaper as saying, "Our favourite (song) is one that Harry Styles wrote with John Legend, it's beautiful and lovely. (Harry) is actually an amazing writer, he's pitched us a few other good ones and they're really good."

Styles is credited with writing 26 songs according to the database of the American Society of Composers, Authors and Publishers, 18 of which are yet to be heard by the public.