NJ:
If you mean having a transformer (LV) within an enclosure with a contactor, with a UL or CSA listing, then it would be acceptable. The wiring methods would have to be compliant also.

The OP I believe is refering to a transformer for a doorbell.


John