I'm going to have to assume this is for a residential home.
There are codes that relate to the design and construction of electrical panels (a.k.a. breaker box). Both OSHA 29 CFR1910.305(d) and NEC NFPA 70 110.27 require that live parts of electrical equipment operating at voltages higher than 50V to be guarded against accidental contact using approved enclosures. OSHA standard describes the situation more vividly by requiring electrical panels to have "dead front". In other words, there should be no energized wires you could possibly touch when you approach the panel from its front.
You could interpret the requirement both ways: most electrical panels have faceplates that go around the breakers and fillers that cover unused breaker positions, and the breakers' bodies themselves are not conductive. So, even with the door off, a properly installed panel would be considered having a "dead front".
HOWEVER: since NEC mentions <strong>"approved"</strong> enclosures, a strict code enforcement officer in your municipality can assert that the door/cover was a part of the enclosureÂ when the said enclosure was undergoing testing at UL or other accredited laboratory and therefore the door should stay.
I understand that this sounds pretty Byzantine, and so I would suggest calling up your township or another authority having jurisdiction (AHJ), find the code enforcer and ask them this question. An appointment may be required in larger municipality.Â Ultimately, they will be the ones saying yay or nay.
Your safest bet: if the panel originally had a door covering the breakers, leave the door on the panel. If the panel didn't have the door, you don't have to add on to it to become code-compliant.