There's rarely a yes or no answer when it comes to electrical regulations! But in this post we try and get as close to a definitive answer as possible.
Let's start with the relevant regulations, which are from the Electricity at Work Regulations 1989. Control panel guidance is set out in two standards, BS 7671 (for electrical installations) and BS EN 60204 (for machines). Usually following the relevant standard will ensure compliance with the regulations. We're going to focus on BS 7671 for this post, also known as '18th edition' (the latest version of the British Standard, published in 2018) or 'wiring regs'.
Essentially BS 7671 it requires any switchgear enclosures in domestic applications (where people live) to be made of non-combustible material. Below is the extract:
Plastic is combustible, so this rules out using plastic enclosures for switchgear in domestic installations.
This also means that for commercial and industrial uses enclosures don't need to be non-combustible at all, so plastic enclosures may well be acceptable. However the installation still has to be safe so it can be argued that an installer could still be prosecuted for damage caused by using a plastic enclosure exposed to heat. Many companies with their own control panel specification will include the requirement for control panel enclosures to be made of a particular material which explicitly reject plastic.
So (especially where the final installation location isn't known) plastic enclosures on control panels aren't best avoided, and metal enclosures are a better option. However metal isn't the only option - GRP enclosures are also non-combustible, such as the Schneider range which are fire resistant to 900 degrees Celsius: www.se.com/uk/en/product/NSYPLM54G/wallmounting-enclosure-polyester-monobloc-ip66-h530xw430xd200mm/
As well as being fire resistant they're rated for outdoor use, with dust and water protection to IP66, so great for weatherproof applications. Metal enclosures are still usually used for indoor use as they're cheaper, more secure and more robust.