The Patron of the Universal Church is barely mentioned in the Gospels. In fact, John and Mark do not mention him at all, and Luke only refers to St. Joseph twice –once in Jesus’ genealogy, to establish his belonging to David’s bloodline, and once in the narrative concerning Jesus’ birth. One might think, then, the sources from which tradition has gotten its inspiration and information to represent him visually are reduced to, exclusively, Matthew’s Gospel. But that is not the case.
The apocryphal Protoevangelium of James, written sometime in the 2nd century and attributed to (though not composed by) the Apostle James the Less, was read and even quoted by some early Christian authors. This “gospel” expanded on what is known about Mary and Joseph from the canonical Gospels, providing the traditional names of Mary’s parents and the stories of her childhood dedicated to the Temple and her engagement to Joseph. It was not admitted into the canon of Scripture when the New Testament was officially determined, but its influence endured in Christian iconography.
Read more at Aleteia