There is no related code requirement. Neither is allowed to interfere with the working space required for the other. Also, if an electronic component cannot be said to be "related to" the electrical installation, there is a rule that would prohibit it from being directly above or below the panel. Also, you have to be able to open a panel door at least 90 degrees, so a nearby component is not allowed to interfere with that action. But otherwise, the two can be literally side-by-side.
Welcome to the forum.