These codes cover the installation and placement of residential circuit breaker boxes including main service panels and subpanels.
Electrical panel box in closet.
If clearance was kept i don t see a major issue as pictured.
This section does not differentiate between one type of clothes closet or another.
According to the national code with relation to electrical panels in closets.
According to section 240 24 d of the national electrical code nec which says overcurrent devices shall not be located in the vicinity of easily ignitable material such as in clothes closets you are not permitted to do this.
If it is on the long wall of the closet all you need is a free 36 of space in front of it 30 in chicago no clothes in the closet for both scenarios.
The wording is vague as it does not absolutely prohibit a panel in a closet more like just around easily ignited materials.
Panels are located in utility closets and approved all the time with proper clearances.
Nema 3r if exposed to weather.
With the electrical panel installed on the narrow side wall there might not be required 30 space unless you have a deep clothes closet.
Nec 240 24d overcurrent devices shall not be located in the vicinity of easily ignitable materials such as a clothes closet.
Rooms circuit breaker boxes may not be installed in bathrooms powder rooms clothes closets or in any room where there is insufficient space for a worker to access and work on the box.
The short safest and most efficient answer to this question is yes.