The study of 2D materials is an active field. Here we investigate the electronic band structures of 2D YOX (F, Cl, Br) in three magnetic orders, including ferromagnetic and antiferromagnetic. Their optical properties are calculated employing first-principles calculations. The cohesive energies of 2D YOX obtained are comparable to those of two-dimensional graphene. Our two-dimensional single-layer structures demonstrate no unstable phonon modes, indicating they are dynamically stable. Our HSE calculations show that these materials are wide-band-gap semiconductors. The charge and spin densities are localized on the Y atoms. The spin-up and spin-down contributions are symmetrical in NM, FM, and AFM magnetic orders, and there are forbidden states between valence and conduction bands. This shows that YOX exhibits a non-magnetic behaviour. The Eg energies obtained with the magnetic order FM and AFM on all atoms are similar to those obtained in the case of the magnetic order FM and AFM only on the Y atoms. Besides, these systems become transparent when the incident lightโs frequency exceeds the plasma frequency (30.00 eV), and a strong absorption appears in their spectrum. Our findings demonstrate that the tunable bandgaps and atomic-level thickness of the two-dimensional compound materials make them attractive candidates for numerous applications, such as electronics, optoelectronics, sensors, and flexible devices.