Electronic and Magnetic phase control in 2D materials