Are we allowed to just trim a newborns head with an electric trimmer, or does it have to be properly shaven off with a razor?

It is only mentioned to shave the head, and it is makruh to leave parts with hair. Thus, you can do so with electric trimmers